Re: [evolution-patches] Fixes #272005



Hey,

I have added action to the Help button so that the calender/ mail/ tasks
help are launched depending on which component invokes the Send Options
dialog. Also the modal issue is now fixed. Hope the patch is correct
now :-).

Cheers,
Shreyas

On Thu, 2005-05-12 at 12:26 +0200, Rodrigo Moya wrote:
> On Thu, 2005-05-12 at 15:30 +0530, Shreyas wrote:
> > Hey,
> > 
> > This fixes the "dialog closes" when Help button is clicked issue with
> > Send Options Dialog. The patch does not associate any action with the
> > Help button but changes the signal handling such that it does not close
> > the Send Options dialog.
> > 
> we either remove the Help button or do something when the user presses
> Help, but the way your patch works, although similar to the old one, is
> not correct, IMO.
> 
> Also, the old dialog is modal, it seems, and the new one modeless.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.355
diff -u -p -w -r1.355 ChangeLog
--- ChangeLog	6 May 2005 06:28:27 -0000	1.355
+++ ChangeLog	12 May 2005 12:08:21 -0000
@@ -1,3 +1,7 @@
+2005-05-12  Shreyas Srinivasan	<sshreyas novell com>
+
+	* e-send-options.c : Fixed #272005
+	
 2005-05-06  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* e-send-options.glade : Fixed a typo. #273095
Index: e-send-options.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-send-options.c,v
retrieving revision 1.5
diff -u -p -w -r1.5 e-send-options.c
--- e-send-options.c	11 Mar 2005 12:02:48 -0000	1.5
+++ e-send-options.c	12 May 2005 12:09:07 -0000
@@ -18,11 +18,16 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Bangalore, MA 02111-1307, India.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
 #include <glib.h>
 #include <gtk/gtksignal.h>
 #include <gtk/gtktogglebutton.h>
 #include <gtk/gtk.h>
+#include <libgnome/libgnome.h>
 #include <libgnome/gnome-i18n.h>
 #include <glade/glade.h>
 #include <time.h>
@@ -89,12 +94,14 @@ struct _ESendOptionsDialogPrivate {
 	GtkWidget *accepted_label;	
 	GtkWidget *completed_label;
 	GtkWidget *until_label;
+        char *help_section;
 };
 
 static void e_sendoptions_dialog_class_init (GObjectClass *object_class);
 static void e_sendoptions_dialog_finalize (GObject *object);
 static void e_sendoptions_dialog_init (GObject *object);
 static void e_sendoptions_dialog_dispose (GObject *object);
+static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data);
 
 static GObjectClass *parent_class = NULL;
 
@@ -379,6 +386,7 @@ init_widgets (ESendOptionsDialog *sod)
 	g_signal_connect (priv->delay_delivery, "toggled", G_CALLBACK (delay_delivery_toggled_cb), sod);	
 	g_signal_connect (priv->create_sent, "toggled", G_CALLBACK (sent_item_toggled_cb), sod);
 
+	g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(e_send_options_cb), sod);
 	g_signal_connect (priv->delay_until, "changed", G_CALLBACK (delay_until_date_changed_cb), sod);
 
 	if (priv->global)
@@ -499,6 +507,7 @@ setup_widgets (ESendOptionsDialog *sod, 
 		
 	switch (type) {
 		case E_ITEM_MAIL:
+		        priv->help_section = g_strdup ("usage-mail");
 			gtk_widget_hide (priv->accepted_label);
 			gtk_widget_hide (priv->when_accepted);
 			gtk_widget_hide (priv->completed_label);
@@ -506,9 +515,11 @@ setup_widgets (ESendOptionsDialog *sod, 
 			gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->declined_label), (_("When de_leted:")));
 			break;
 		case E_ITEM_CALENDAR:
+         	        priv->help_section = g_strdup ("usage-calendar");
 			gtk_widget_hide (priv->completed_label);
 			gtk_widget_hide (priv->when_completed);
 		case E_ITEM_TASK:
+		        priv->help_section = g_strdup ("usage-calendar-todo");
 			gtk_widget_hide (priv->classification_label);
 			gtk_widget_hide (priv->classification);
 			gtk_widget_set_sensitive (priv->autodelete, FALSE);
@@ -568,12 +579,41 @@ e_sendoptions_set_global (ESendOptionsDi
 	return TRUE;
 }
 
+static void e_send_options_cb (GtkDialog *dialog, gint state, gpointer func_data)
+{
+
+    ESendOptionsDialogPrivate *priv;
+    ESendOptionsDialog *sod;
+    GError *error = NULL;     
+
+    sod = func_data;
+    priv = sod->priv;
+
+    switch (state) {
+	case GTK_RESPONSE_OK:
+	    e_send_options_get_widgets_data (sod);
+	case GTK_RESPONSE_CANCEL:
+	    gtk_widget_hide (priv->main);
+	    gtk_widget_destroy (priv->main);
+	    g_object_unref (priv->xml);
+	    break;
+	case GTK_RESPONSE_HELP:
+	gnome_help_display_desktop (NULL,
+				    "evolution-" BASE_VERSION,
+				    "evolution-" BASE_VERSION ".xml",
+				    priv->help_section,
+				    &error);
+	    if (error != NULL)
+		g_warning ("%s", error->message);
+	    break;
+    }
+}
+
 gboolean 
 e_sendoptions_dialog_run (ESendOptionsDialog *sod, GtkWidget *parent, Item_type type)
 {
 	ESendOptionsDialogPrivate *priv;
 	GtkWidget *toplevel;
-	int result;
 
 	g_return_val_if_fail (sod != NULL || E_IS_SENDOPTIONS_DIALOG (sod), FALSE);
 	
@@ -606,15 +646,9 @@ e_sendoptions_dialog_run (ESendOptionsDi
 	e_send_options_fill_widgets_with_data (sod);
 	sensitize_widgets (sod);
 	init_widgets (sod);
+	gtk_window_set_modal ((GtkWindow *)priv->main, TRUE);
 
-	result = gtk_dialog_run (GTK_DIALOG (priv->main));
-	
-	if (result == GTK_RESPONSE_OK) 
-		e_send_options_get_widgets_data (sod);
-	
-	gtk_widget_hide (priv->main);
-	gtk_widget_destroy (priv->main);
-	g_object_unref (priv->xml);
+	gtk_widget_show (priv->main);
 
 	return TRUE;
 }
@@ -627,6 +661,8 @@ e_sendoptions_dialog_finalize (GObject *
 
 	g_return_if_fail (E_IS_SENDOPTIONS_DIALOG (sod));
 	priv = sod->priv;
+
+	g_free (priv->help_section);
 
 	if (sod->data->gopts) {
 		g_free (sod->data->gopts);


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