]> Pileus Git - ~andy/gtk/commitdiff
Some GtkApplication cleanups
authorMatthias Clasen <mclasen@redhat.com>
Sat, 23 Oct 2010 19:24:24 +0000 (21:24 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 23 Oct 2010 19:24:24 +0000 (21:24 +0200)
Remove no-longer-needed vfuncs, no longer existing functions,
and improve the docs here and there.

gtk/gtkapplication.c
gtk/gtkapplication.h
gtk/gtkwindow.c

index 11af1baed359460559c114074395f005795b297b..70c9754177971fb2e8b1335c77f10c39bf91d5cf 100644 (file)
  * of a GTK+ application in a convenient fashion, without enforcing
  * a one-size-fits-all application model.
  *
- * Currently, GtkApplication handles application uniqueness, provides
- * some basic scriptability by exporting 'actions', implements some
- * standard actions itself (such as 'Quit') and provides a main window
- * whose life-cycle is automatically tied to the life-cycle of your
- * application.
+ * Currently, GtkApplication handles GTK+ initialization, application
+ * uniqueness, provides some basic scriptability by exporting 'actions',
+ * implements some standard actions itself (such as 'Quit') and manages
+ * a list of toplevel windows whose life-cycle is automatically tied to
+ * the life-cycle of your application.
  *
  * <example id="gtkapplication"><title>A simple application</title>
  * <programlisting>
@@ -151,6 +151,20 @@ gtk_application_class_init (GtkApplicationClass *class)
   g_type_class_add_private (class, sizeof (GtkApplicationPrivate));
 }
 
+/**
+ * gtk_application_new:
+ * @application_id: the application id
+ * @flags: the application flags
+ *
+ * Creates a new #GtkApplication instance.
+ *
+ * This function calls g_type_init() for you. gtk_init() is called
+ * as soon as the application gets registered as the primary instance.
+ *
+ * The application id must be valid. See g_application_id_is_valid().
+ *
+ * Returns: a new #GtkApplication instance
+ */
 GtkApplication *
 gtk_application_new (const gchar       *application_id,
                      GApplicationFlags  flags)
@@ -181,12 +195,15 @@ void
 gtk_application_add_window (GtkApplication *application,
                             GtkWindow      *window)
 {
+  GtkApplicationPrivate *priv;
+
   g_return_if_fail (GTK_IS_APPLICATION (application));
 
-  if (!g_list_find (application->priv->windows, window))
+  priv = application->priv;
+
+  if (!g_list_find (priv->windows, window))
     {
-      application->priv->windows = g_list_prepend (application->priv->windows,
-                                                   window);
+      priv->windows = g_list_prepend (priv->windows, window);
       gtk_window_set_application (window, application);
       g_application_hold (G_APPLICATION (application));
     }
@@ -212,12 +229,14 @@ void
 gtk_application_remove_window (GtkApplication *application,
                                GtkWindow      *window)
 {
+  GtkApplicationPrivate *priv;
+
   g_return_if_fail (GTK_IS_APPLICATION (application));
 
-  if (g_list_find (application->priv->windows, window))
+  priv = application->priv;
+  if (g_list_find (priv->windows, window))
     {
-      application->priv->windows = g_list_remove (application->priv->windows,
-                                                  window);
+      priv->windows = g_list_remove (priv->windows, window);
       g_application_release (G_APPLICATION (application));
       gtk_window_set_application (window, NULL);
     }
index c9c8571a466ad062acfe4365f355f6917453dc28..8fafd4ef5b4b529be5c9e81d074f718c41e521e3 100644 (file)
@@ -55,9 +55,6 @@ struct _GtkApplicationClass
 {
   GApplicationClass parent_class;
 
-  /*< vfuncs >*/
-  GtkWindow *(* create_window) (GtkApplication *application);
-
   /*< private >*/
   gpointer padding[12];
 };
index 08202a29b69dbb54a5c3366129518e79f8bd1e29..fb63d1c4d2d3ce1b7a5df86f62f8aab7ff13e55f 100644 (file)
@@ -2673,19 +2673,22 @@ void
 gtk_window_set_application (GtkWindow      *window,
                             GtkApplication *application)
 {
+  GtkWindowPrivate *priv;
+
   g_return_if_fail (GTK_IS_WINDOW (window));
 
-  if (window->priv->application != application)
+  priv = window->priv;
+  if (priv->application != application)
     {
       gtk_window_release_application (window);
 
-      window->priv->application = application;
+      priv->application = application;
 
-      if (window->priv->application != NULL)
+      if (priv->application != NULL)
         {
-          g_object_ref (window->priv->application);
+          g_object_ref (priv->application);
 
-          gtk_application_add_window (window->priv->application, window);
+          gtk_application_add_window (priv->application, window);
         }
 
       g_object_notify (G_OBJECT (window), "application");