[Gpa-commits] r985 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Apr 20 00:30:26 CEST 2009


Author: moritzs
Date: 2009-04-20 00:30:24 +0200 (Mon, 20 Apr 2009)
New Revision: 985

Modified:
   trunk/src/ChangeLog
   trunk/src/cardman.c
   trunk/src/cm-object.c
   trunk/src/cm-object.h
   trunk/src/cm-openpgp.c
   trunk/src/gtktools.c
Log:
2009-04-20  Moritz  <moritz at gnu.org>

	* cm-openpgp.c (save_attr): Call gpa_cm_object_alert_dialog()
	instead of gpa_window_error().
	* gtktools.c (gpa_window_error): Use
	gtk_window_set_transient_for().
	* cm-object.c: New item ALERT_DIALOG in enum.
	(gpa_cm_object_class_init): Register "alert-dialog" signal through
	g_signal_new.
	(gpa_cm_object_alert_dialog): New function, emits alert-dialog
	signal on given object.
	* cm-object.h (struct _GpaCMObjectClass): New member: alert_dialog.
	Declare function gpa_cm_object_alert_dialog.
	* cardman.c (alert_dialog_cb): New function.
	(update_card_widget): Connect to alert-dialog signal of newly
	created GpaCMObject object.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/ChangeLog	2009-04-19 22:30:24 UTC (rev 985)
@@ -1,3 +1,20 @@
+2009-04-20  Moritz  <moritz at gnu.org>
+
+	* cm-openpgp.c (save_attr): Call gpa_cm_object_alert_dialog()
+	instead of gpa_window_error().
+	* gtktools.c (gpa_window_error): Use
+	gtk_window_set_transient_for().
+	* cm-object.c: New item ALERT_DIALOG in enum.
+	(gpa_cm_object_class_init): Register "alert-dialog" signal through
+	g_signal_new.
+	(gpa_cm_object_alert_dialog): New function, emits alert-dialog
+	signal on given object.
+	* cm-object.h (struct _GpaCMObjectClass): New member: alert_dialog.
+	Declare function gpa_cm_object_alert_dialog.
+	* cardman.c (alert_dialog_cb): New function.
+	(update_card_widget): Connect to alert-dialog signal of newly
+	created GpaCMObject object.
+
 2009-04-10  Moritz  <moritz at gnu.org>
 
 	* cm-openpgp.c (add_table_row): Made labels top aligned, so that

Modified: trunk/src/cardman.c
===================================================================
--- trunk/src/cardman.c	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/cardman.c	2009-04-19 22:30:24 UTC (rev 985)
@@ -152,7 +152,14 @@
   gtk_label_set_text (GTK_LABEL (cardman->status_text), status);
 }
 
+/* Signal handler for GpaCMObject's "alert-dialog".  */
+static void
+alert_dialog_cb (GpaCardManager *cardman, gchar *msg)
+{
+  gpa_window_error (msg, GTK_WIDGET (cardman));
+}
 
+
 static void
 update_title (GpaCardManager *cardman)
 {
@@ -758,6 +765,9 @@
       g_signal_connect_swapped (G_OBJECT (cardman->card_widget),
                                 "update-status",
                                 G_CALLBACK (statusbar_update_cb), cardman);
+      g_signal_connect_swapped (G_OBJECT (cardman->card_widget),
+				"alert-dialog",
+				G_CALLBACK (alert_dialog_cb), cardman);
 
       /* Fixme: We should use a signal to reload the card widget
          instead of using a class test in each reload fucntion.  */

Modified: trunk/src/cm-object.c
===================================================================
--- trunk/src/cm-object.c	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/cm-object.c	2009-04-19 22:30:24 UTC (rev 985)
@@ -35,6 +35,7 @@
 enum
 {
   UPDATE_STATUS,
+  ALERT_DIALOG,
   LAST_SIGNAL
 };
 
@@ -80,7 +81,14 @@
                   g_cclosure_marshal_VOID__STRING,
 		  G_TYPE_NONE, 1, G_TYPE_STRING);
 
-
+  signals[ALERT_DIALOG] =
+    g_signal_new ("alert-dialog",
+		  G_TYPE_FROM_CLASS (klass),
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
+		  G_STRUCT_OFFSET (GpaCMObjectClass, alert_dialog),
+		  NULL, NULL,
+                  g_cclosure_marshal_VOID__STRING,
+		  G_TYPE_NONE, 1, G_TYPE_STRING);
 }
 
 
@@ -149,3 +157,13 @@
 
   g_signal_emit (obj, signals[UPDATE_STATUS], 0, text);
 }
+
+/* Emit the error message MSG.  */
+void
+gpa_cm_object_alert_dialog (GpaCMObject *obj, const gchar *messageg)
+{
+  g_return_if_fail (obj);
+  g_return_if_fail (GPA_CM_OBJECT (obj));
+  
+  g_signal_emit (obj, signals[ALERT_DIALOG], 0, messageg);
+}

Modified: trunk/src/cm-object.h
===================================================================
--- trunk/src/cm-object.h	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/cm-object.h	2009-04-19 22:30:24 UTC (rev 985)
@@ -55,6 +55,7 @@
 
   /* Signal handlers */
   void (*update_status) (GpaCMObject *obj, gchar *status);
+  void (*alert_dialog) (GpaCMObject *obj, gchar *message);
 };
 
 
@@ -73,7 +74,7 @@
 /* The class specific API.  */
 
 void gpa_cm_object_update_status (GpaCMObject *obj, const char *text);
+void gpa_cm_object_alert_dialog (GpaCMObject *obj, const gchar *messageg);
 
 
-
 #endif /*CM_OBJECT_H*/

Modified: trunk/src/cm-openpgp.c
===================================================================
--- trunk/src/cm-openpgp.c	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/cm-openpgp.c	2009-04-19 22:30:24 UTC (rev 985)
@@ -592,7 +592,7 @@
       char *message = g_strdup_printf 
         (_("Error saving the changed values.\n"
            "(%s <%s>)"), gpg_strerror (err), gpg_strsource (err));
-      gpa_window_error (message, NULL);
+      gpa_cm_object_alert_dialog (card, message);
       xfree (message);
     }
   xfree (command);

Modified: trunk/src/gtktools.c
===================================================================
--- trunk/src/gtktools.c	2009-04-10 21:44:23 UTC (rev 984)
+++ trunk/src/gtktools.c	2009-04-19 22:30:24 UTC (rev 985)
@@ -52,6 +52,9 @@
                                              _("_Close"),
                                              GTK_RESPONSE_CLOSE,
                                              NULL);
+  if (messenger)
+    gtk_window_set_transient_for (GTK_WINDOW (windowError), GTK_WINDOW (messenger));
+
   gtk_container_set_border_width (GTK_CONTAINER (windowError), 5);
   gtk_dialog_set_default_response (GTK_DIALOG (windowError),
                                    GTK_RESPONSE_CLOSE);



More information about the Gpa-commits mailing list