[Gpa-commits] r874 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Apr 21 17:22:45 CEST 2008


Author: marcus
Date: 2008-04-21 17:22:42 +0200 (Mon, 21 Apr 2008)
New Revision: 874

Added:
   trunk/src/gpaprogressbar.c
   trunk/src/gpaprogressbar.h
Modified:
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/gpaprogressdlg.c
   trunk/src/gpaprogressdlg.h
Log:
2008-04-21  Marcus Brinkmann  <marcus at g10code.de>

	* Makefile.am (gpa_SOURCES): Add gpaprogressbar.h, gpaprogressbar.c.
	* gpaprogressbar.h, gpaprogressbar.c: New files.
	* gpaprogressdlg.h, gpaprogressdlg.c: Use GpaProgressBar.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/ChangeLog	2008-04-21 15:22:42 UTC (rev 874)
@@ -1,3 +1,9 @@
+2008-04-21  Marcus Brinkmann  <marcus at g10code.de>
+
+	* Makefile.am (gpa_SOURCES): Add gpaprogressbar.h, gpaprogressbar.c.
+	* gpaprogressbar.h, gpaprogressbar.c: New files.
+	* gpaprogressdlg.h, gpaprogressdlg.c: Use GpaProgressBar.
+
 2008-04-09  Marcus Brinkmann  <marcus at g10code.de>
 
 	* keylist.c (setup_columns): Change attribute of

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/Makefile.am	2008-04-21 15:22:42 UTC (rev 874)
@@ -72,6 +72,7 @@
 	      passwddlg.h passwddlg.c \
 	      gpacontext.h gpacontext.c \
 	      gpaprogressdlg.h gpaprogressdlg.c \
+	      gpaprogressbar.h gpaprogressbar.c \
 	      gparecvkeydlg.h gparecvkeydlg.c \
 	      gpaoperation.h gpaoperation.c \
 	      gpastreamop.h gpastreamop.c  \

Added: trunk/src/gpaprogressbar.c
===================================================================
--- trunk/src/gpaprogressbar.c	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/gpaprogressbar.c	2008-04-21 15:22:42 UTC (rev 874)
@@ -0,0 +1,234 @@
+/* gpaprogressbar.c - The GpaProgressBar object.
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2008 g10 Code GmbH.
+
+   This file is part of GPA.
+
+   GPA 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.
+
+   GPA 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.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "gpaprogressbar.h"
+#include "i18n.h"
+
+
+/* Properties.  */
+enum
+{
+  PROP_0,
+  PROP_CONTEXT
+};
+
+
+static GObjectClass *parent_class = NULL;
+
+
+static void
+gpa_progress_bar_get_property (GObject *object, guint prop_id, GValue *value,
+			       GParamSpec *pspec)
+{
+  GpaProgressBar *pbar = GPA_PROGRESS_BAR (object);
+
+  switch (prop_id)
+    {
+    case PROP_CONTEXT:
+      g_value_set_object (value, pbar->context);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+static void
+gpa_progress_bar_set_property (GObject *object, guint prop_id,
+			       const GValue *value, GParamSpec *pspec)
+{
+  GpaProgressBar *pbar = GPA_PROGRESS_BAR (object);
+
+  switch (prop_id)
+    {
+    case PROP_CONTEXT:
+      gpa_progress_bar_set_context (pbar, g_value_get_object (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+static void
+gpa_progress_bar_finalize (GObject *object)
+{  
+  GpaProgressBar *pbar = GPA_PROGRESS_BAR (object);
+  GpaContext *context = pbar->context;
+
+  if (context)
+    {
+      g_signal_handler_disconnect (G_OBJECT (context), pbar->sig_id_start);
+      g_signal_handler_disconnect (G_OBJECT (context), pbar->sig_id_done);
+      g_signal_handler_disconnect (G_OBJECT (context), pbar->sig_id_progress);
+    }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gpa_progress_bar_class_init (GpaProgressBarClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  
+  parent_class = g_type_class_peek_parent (klass);
+
+  object_class->finalize = gpa_progress_bar_finalize;
+  object_class->set_property = gpa_progress_bar_set_property;
+  object_class->get_property = gpa_progress_bar_get_property;
+
+  /* Properties.  */
+  g_object_class_install_property (object_class,
+				   PROP_CONTEXT,
+				   g_param_spec_object 
+				   ("context", "context",
+				    "context", GPA_CONTEXT_TYPE,
+				    G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+
+static void
+gpa_progress_bar_init (GpaProgressBar *pbar)
+{
+}
+
+
+GType
+gpa_progress_bar_get_type (void)
+{
+  static GType progress_bar_type = 0;
+  
+  if (! progress_bar_type)
+    {
+      static const GTypeInfo progress_bar_info =
+      {
+        sizeof (GpaProgressBarClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gpa_progress_bar_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GpaProgressBar),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gpa_progress_bar_init,
+      };
+      
+      progress_bar_type = g_type_register_static (GTK_TYPE_PROGRESS_BAR,
+						  "GpaProgressBar",
+						  &progress_bar_info, 0);
+    }
+  
+  return progress_bar_type;
+}
+
+
+/* API.  */
+
+/* Create a new progress bar.  */
+GtkWidget *
+gpa_progress_bar_new (void)
+{
+  GpaProgressBar *pbar;
+  
+  pbar = g_object_new (GPA_PROGRESS_BAR_TYPE, NULL);
+
+  return GTK_WIDGET (pbar);
+}
+
+
+/* Create a new progress bar for the given context.  */
+GtkWidget *
+gpa_progress_bar_new_with_context (GpaContext *context)
+{
+  GpaProgressBar *pbar;
+  
+  pbar = g_object_new (GPA_PROGRESS_BAR_TYPE, "context", context, NULL);
+
+  return GTK_WIDGET (pbar);
+}
+
+
+static void
+progress_cb (GpaContext *context, int current, int total, GpaProgressBar *pbar)
+{
+  g_print ("progress %i %i\n", current, total);
+  if (total > 0) 
+    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pbar),
+				   (gdouble) current / (gdouble) total);
+  else
+    gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pbar));
+}
+
+
+static void
+start_cb (GpaContext *context, GpaProgressBar *pbar)
+{
+  progress_cb (context, 0, 1, pbar);
+}
+
+
+static void
+done_cb (GpaContext *context, gpg_error_t err, GpaProgressBar *pbar)
+{
+  progress_cb (context, 1, 1, pbar);
+}
+
+
+GpaContext *
+gpa_progress_bar_get_context (GpaProgressBar *pbar)
+{
+  g_return_val_if_fail (GTK_IS_PROGRESS_BAR (pbar), 0);
+  return pbar->context;
+}
+
+
+void
+gpa_progress_bar_set_context (GpaProgressBar *pbar, GpaContext *context)
+{
+  g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
+
+  if (pbar->context)
+    {
+      g_signal_handler_disconnect (G_OBJECT (pbar->context),
+				   pbar->sig_id_start);
+      g_signal_handler_disconnect (G_OBJECT (pbar->context),
+				   pbar->sig_id_done);
+      g_signal_handler_disconnect (G_OBJECT (pbar->context),
+				   pbar->sig_id_progress);
+    }
+  
+  pbar->context = context;
+  if (context)
+    {
+      pbar->sig_id_start = g_signal_connect (G_OBJECT (context), "start",
+					     G_CALLBACK (start_cb), pbar);
+      pbar->sig_id_done = g_signal_connect (G_OBJECT (context), "done",
+					    G_CALLBACK (done_cb), pbar);
+      pbar->sig_id_progress = g_signal_connect (G_OBJECT (context), "progress",
+						G_CALLBACK (progress_cb), pbar);
+    }
+}

Added: trunk/src/gpaprogressbar.h
===================================================================
--- trunk/src/gpaprogressbar.h	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/gpaprogressbar.h	2008-04-21 15:22:42 UTC (rev 874)
@@ -0,0 +1,83 @@
+/* gpaprogressbar.h - The GpaProgressBar object.
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2008 g10 Code GmbH.
+
+   This file is part of GPA.
+
+   GPA 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.
+
+   GPA 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.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
+
+#ifndef GPA_PROGRESS_BAR_H
+#define GPA_PROGRESS_BAR_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include "gpacontext.h"
+
+/* GObject stuff */
+#define GPA_PROGRESS_BAR_TYPE (gpa_progress_bar_get_type ())
+#define GPA_PROGRESS_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPA_PROGRESS_BAR_TYPE, GpaProgressBar))
+#define GPA_PROGRESS_BAR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GPA_PROGRESS_BAR_TYPE, GpaProgressBarClass))
+#define GPA_IS_PROGRESS_BAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPA_PROGRESS_BAR_TYPE))
+#define GPA_IS_PROGRESS_BAR_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GPA_PROGRESS_BAR_TYPE))
+#define GPA_PROGRESS_BAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GPA_PROGRESS_BAR_TYPE, GpaProgressBarClass))
+
+
+typedef struct _GpaProgressBar GpaProgressBar;
+typedef struct _GpaProgressBarClass GpaProgressBarClass;
+
+
+struct _GpaProgressBar
+{
+  GtkProgressBar parent;
+
+  GpaContext *context;
+
+  /* Private.  */
+  gulong sig_id_progress;
+  gulong sig_id_start;
+  gulong sig_id_done;
+};
+
+
+struct _GpaProgressBarClass
+{
+  GtkProgressBarClass parent_class;
+};
+
+
+GType gpa_progress_bar_get_type (void) G_GNUC_CONST;
+
+
+/* API */
+
+/* Create a new progress bar.  */
+GtkWidget *gpa_progress_bar_new (void);
+
+/* Create a new progress bar for the given context.  */
+GtkWidget *gpa_progress_bar_new_with_context (GpaContext *context);
+
+/* Set the context.  */
+GpaContext *gpa_progress_bar_get_context (GpaProgressBar *pbar);
+
+/* Get the context.  */
+void gpa_progress_bar_set_context (GpaProgressBar *pbar, GpaContext *context);
+
+#endif

Modified: trunk/src/gpaprogressdlg.c
===================================================================
--- trunk/src/gpaprogressdlg.c	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/gpaprogressdlg.c	2008-04-21 15:22:42 UTC (rev 874)
@@ -1,40 +1,32 @@
 /* gpaprogressdlg.h - The GpaProgressDialog object.
- *	Copyright (C) 2003, Miguel Coca.
- *
- * This file is part of GPA
- *
- * GPA 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.
- *
- * GPA 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
- */
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2008 g10 Code GmbH.
 
-#include <config.h>
+   This file is part of GPA.
 
+   GPA 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.
+
+   GPA 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.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "gpaprogressdlg.h"
 #include "i18n.h"  
 
-/* Internal functions */
-static void
-gpa_progress_dialog_start_cb (GpaContext *context,
-			      GpaProgressDialog *dialog);
-static void
-gpa_progress_dialog_done_cb (GpaContext *context, gpg_error_t err,
-			     GpaProgressDialog *dialog);
-static void
-gpa_progress_dialog_progress_cb (GpaContext *context, int current, int total,
-				 GpaProgressDialog *dialog);
 
-/* Properties */
+/* Properties.  */
 enum
 {
   PROP_0,
@@ -42,13 +34,15 @@
   PROP_CONTEXT
 };
 
+
 static GObjectClass *parent_class = NULL;
 
+
 static void
-gpa_progress_dialog_get_property (GObject     *object,
-				  guint        prop_id,
-				  GValue      *value,
-				  GParamSpec  *pspec)
+gpa_progress_dialog_get_property (GObject *object,
+				  guint prop_id,
+				  GValue *value,
+				  GParamSpec *pspec)
 {
   GpaProgressDialog *dialog = GPA_PROGRESS_DIALOG (object);
 
@@ -59,7 +53,7 @@
 			  gtk_window_get_transient_for (GTK_WINDOW (dialog)));
       break;
     case PROP_CONTEXT:
-      g_value_set_object (value, dialog->context);
+      g_value_set_object (value, gpa_progress_bar_get_context (dialog->pbar));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -67,6 +61,7 @@
     }
 }
 
+
 static void
 gpa_progress_dialog_set_property (GObject     *object,
 				  guint        prop_id,
@@ -82,14 +77,8 @@
 				    g_value_get_object (value));
       break;
     case PROP_CONTEXT:
-      dialog->context = (GpaContext*) g_value_get_object (value);
-      /* Context signals */
-      g_signal_connect (G_OBJECT (dialog->context), "start",
-			G_CALLBACK (gpa_progress_dialog_start_cb), dialog);
-      g_signal_connect (G_OBJECT (dialog->context), "done",
-			G_CALLBACK (gpa_progress_dialog_done_cb), dialog);
-      g_signal_connect (G_OBJECT (dialog->context), "progress",
-			G_CALLBACK (gpa_progress_dialog_progress_cb), dialog);
+      gpa_progress_bar_set_context (dialog->pbar,
+				    (GpaContext *) g_value_get_object (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -97,12 +86,14 @@
     }
 }
 
+
 static void
 gpa_progress_dialog_finalize (GObject *object)
 {  
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+
 static void
 gpa_progress_dialog_class_init (GpaProgressDialogClass *klass)
 {
@@ -114,7 +105,7 @@
   object_class->set_property = gpa_progress_dialog_set_property;
   object_class->get_property = gpa_progress_dialog_get_property;
 
-  /* Properties */
+  /* Properties.  */
   g_object_class_install_property (object_class,
 				   PROP_WINDOW,
 				   g_param_spec_object 
@@ -129,33 +120,36 @@
 				    G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
 }
 
+
 static void
 gpa_progress_dialog_init (GpaProgressDialog *dialog)
 {
   gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
 				  5);
-  /* Elements */
+  /* Elements.  */
   dialog->label = gtk_label_new (NULL);
   gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
 			       dialog->label);
-  dialog->progress_bar = gtk_progress_bar_new ();
+  dialog->pbar = gpa_progress_bar_new ();
   gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
-			       dialog->progress_bar);
-  /* Set up the dialog */
+			       GTK_WIDGET (dialog->pbar));
+  /* Set up the dialog.  */
   gtk_dialog_add_button (GTK_DIALOG (dialog),
 			 _("_Cancel"),
 			 GTK_RESPONSE_CANCEL);
-  /* FIXME: Cancelling is not supported yet by GPGME */
+
+  /* FIXME: Cancelling is not supported yet by GPGME.  */
   gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL,
 				     FALSE);
 }
 
+
 GType
 gpa_progress_dialog_get_type (void)
 {
   static GType progress_dialog_type = 0;
   
-  if (!progress_dialog_type)
+  if (! progress_dialog_type)
     {
       static const GTypeInfo progress_dialog_info =
       {
@@ -178,10 +172,10 @@
   return progress_dialog_type;
 }
 
+
 /* API */
 
-/* Create a new progress dialog for the given context.
- */
+/* Create a new progress dialog for the given context.  */
 GtkWidget*
 gpa_progress_dialog_new (GtkWidget *parent, 
 			 GpaContext *context)
@@ -196,40 +190,10 @@
   return GTK_WIDGET(dialog);
 }
 
-/* Set the dialog label.
- */
+
+/* Set the dialog label.  */
 void
 gpa_progress_dialog_set_label (GpaProgressDialog *dialog, const gchar *label)
 {
   gtk_label_set_text (GTK_LABEL (dialog->label), label);
 }
-
-/* Internal functions */
-
-static void
-gpa_progress_dialog_progress_cb (GpaContext *context, int current, int total,
-				 GpaProgressDialog *dialog)
-{
-  if (total > 0) 
-    {
-      gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dialog->progress_bar),
-				     (gdouble)current/(gdouble)total);
-    }
-  else
-    {
-      gtk_progress_bar_pulse (GTK_PROGRESS_BAR (dialog->progress_bar));
-    }
-}
-
-static void
-gpa_progress_dialog_start_cb (GpaContext *context,
-			      GpaProgressDialog *dialog)
-{
-}
-
-static void
-gpa_progress_dialog_done_cb (GpaContext *context, gpg_error_t err,
-			     GpaProgressDialog *dialog)
-{
-}
-

Modified: trunk/src/gpaprogressdlg.h
===================================================================
--- trunk/src/gpaprogressdlg.h	2008-04-09 20:51:11 UTC (rev 873)
+++ trunk/src/gpaprogressdlg.h	2008-04-21 15:22:42 UTC (rev 874)
@@ -1,23 +1,23 @@
 /* gpaprogressdlg.h - The GpaProgressDialog object.
- *	Copyright (C) 2003, Miguel Coca.
- *
- * This file is part of GPA
- *
- * GPA 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.
- *
- * GPA 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
- */
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2008 g10 Code GmbH.
 
+   This file is part of GPA.
+
+   GPA 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.
+
+   GPA 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.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
+
 #ifndef GPA_PROGRESS_DIALOG_H
 #define GPA_PROGRESS_DIALOG_H
 
@@ -25,42 +25,56 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 #include "gpacontext.h"
+#include "gpaprogressbar.h"
 
-/* GObject stuff */
-#define GPA_PROGRESS_DIALOG_TYPE	  (gpa_progress_dialog_get_type ())
-#define GPA_PROGRESS_DIALOG(obj)	  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPA_PROGRESS_DIALOG_TYPE, GpaProgressDialog))
-#define GPA_PROGRESS_DIALOG_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), GPA_PROGRESS_DIALOG_TYPE, GpaProgressDialogClass))
-#define GPA_IS_PROGRESS_DIALOG(obj)	  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPA_PROGRESS_DIALOG_TYPE))
-#define GPA_IS_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GPA_PROGRESS_DIALOG_TYPE))
-#define GPA_PROGRESS_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GPA_PROGRESS_DIALOG_TYPE, GpaProgressDialogClass))
+/* GObject stuff.  */
+#define GPA_PROGRESS_DIALOG_TYPE (gpa_progress_dialog_get_type ())
+#define GPA_PROGRESS_DIALOG(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPA_PROGRESS_DIALOG_TYPE, \
+   GpaProgressDialog))
+#define GPA_PROGRESS_DIALOG_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), GPA_PROGRESS_DIALOG_TYPE, \
+   GpaProgressDialogClass))
+#define GPA_IS_PROGRESS_DIALOG(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPA_PROGRESS_DIALOG_TYPE))
+#define GPA_IS_PROGRESS_DIALOG_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), GPA_PROGRESS_DIALOG_TYPE))
+#define GPA_PROGRESS_DIALOG_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), GPA_PROGRESS_DIALOG_TYPE, \
+   GpaProgressDialogClass))
 
+
 typedef struct _GpaProgressDialog GpaProgressDialog;
 typedef struct _GpaProgressDialogClass GpaProgressDialogClass;
 
-struct _GpaProgressDialog {
+
+struct _GpaProgressDialog
+{
   GtkDialog parent;
 
   GpaContext *context;
-  GtkWidget *progress_bar, *label;
+  GpaProgressBar *pbar;
+  GtkWidget *label;
   guint timer;
 };
 
-struct _GpaProgressDialogClass {
+
+struct _GpaProgressDialogClass
+{
   GtkDialogClass parent_class;
 };
 
+
 GType gpa_progress_dialog_get_type (void) G_GNUC_CONST;
 
-/* API */
+
+/* API.  */
 
-/* Create a new progress dialog for the given context.
- */
-GtkWidget*
-gpa_progress_dialog_new (GtkWidget *parent, GpaContext *context);
+/* Create a new progress dialog for the given context.  */
+GtkWidget *gpa_progress_dialog_new (GtkWidget *parent, GpaContext *context);
 
-/* Set the dialog label.
- */
-void
-gpa_progress_dialog_set_label (GpaProgressDialog *dialog, const gchar *label);
+/* Set the dialog label.  */
+void gpa_progress_dialog_set_label (GpaProgressDialog *dialog,
+				    const gchar *label);
 
 #endif



More information about the Gpa-commits mailing list