Re: [evolution-patches] camel provider changes for connector



Hi,

I have incorporated all your review comments. I am attaching my new updated patch now. Please review it and let me know if it is fine.

On Tue, 2004-04-27 at 17:16 +0800, Not Zed wrote:
On Tue, 2004-04-27 at 13:47 +0530, Sarfraaz Ahmed wrote:

But I think you should do this, even though it might do funny things for people who have run the current version (i dont know what gconf will do if you change the type of the value).

You mean current version of gconf ?? Anyway, I shall do this change and send the updated patch ...
Naah i mean if they've run the version of evolution which uses a string for the value inside gconf, and then run a new one which expects a string list, it may cause a version conflict.  If it was a totally different version of evo we'd have to do some sort of migration, but in a development release cycle, for such a minor thing, the few users it affects can fix it themselves.
Oh, this is a very valid point. But as of now, it is just connector that has the HAS_LICENSE flag set, and i have yet to commit those changes. So practically, its only me who should be seeing this behaviour now ... though, i did not .. its working fine with the changes now.

I dont think it should be a stock button, although in code you can make it a stock-looking button with an "Accept License" label.  I do not know the answer to this, but I do know from the HIG error message work I did that directional labels are preferred.  I don't know what they say about icons.

Well, i am not much aware of these guidelines yet. Planning to go through them sometime. For the time being, i just created an icon for the "Accept License" button. This now kinda looks good to me. I have attached that snapshot below. I guess, i should go with that for now, till we get the feedback on that HIG bug i filed.
I guess that'll do for now.

I have also updated the glade file in the patch now, with that image in the "Accept License" button.

Cheers,
Michael

Michael Zucchi <notzed ximian com>

Ximian Evolution and Free Software Developer


Novell, Inc.
            Thanks
                                        -- Sarfraaz Ahmed <asarfraaz novell com>
Index: mail-account-gui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v
retrieving revision 1.161
diff -u -r1.161 mail-account-gui.c
--- mail-account-gui.c	28 Apr 2004 06:39:25 -0000	1.161
+++ mail-account-gui.c	30 Apr 2004 14:41:19 -0000
@@ -157,21 +157,6 @@
 	g_free (value);
 }
 
-static void 
-set_license_rejected (GtkWidget *widget, gpointer data)
-{
-	gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_DELETE_EVENT);
-	return;
-}
-
-static void
-set_license_accepted (GtkWidget *widget, gpointer data)
-{
-	gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_ACCEPT);
-	return;
-
-}
-
 static void
 check_button_state (GtkToggleButton *button, gpointer data)
 {
@@ -217,7 +202,7 @@
 }
 
 static gboolean
-display_license(const char *filename)
+display_license (const char *filename, const char *lic_name)
 {
 	GladeXML *xml;
 	GtkWidget *top_widget;
@@ -225,6 +210,8 @@
 	GtkButton *button_yes, *button_no;
 	GtkCheckButton *check_button;
 	GtkResponseType response;
+	GtkLabel *top_label;
+	char *label_text, *dialog_title;
 	gboolean status;
 	
 	xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-license.glade", 
@@ -246,25 +233,36 @@
 	check_button = GTK_CHECK_BUTTON (glade_xml_get_widget (xml, 
 							"lic_checkbutton"));
 
+	top_label = GTK_LABEL (glade_xml_get_widget (xml, "lic_top_label"));
+
+	label_text = g_strdup_printf ("
+		 Please read carefully the license agreement
+		 for %s displayed below
+		 and tick the check box for accepting it
+			", lic_name);
+
+	gtk_label_set_label (top_label, label_text);
+
+	dialog_title = g_strdup_printf ("%s License Agreement", lic_name);
+	
+	gtk_window_set_title (GTK_WINDOW (top_widget), dialog_title);
+
 	g_signal_connect (check_button, "toggled", 
 				G_CALLBACK (check_button_state), button_yes);
-	g_signal_connect (button_yes, "clicked", 
-				G_CALLBACK (set_license_accepted), 
-				GTK_WIDGET (top_widget));
-	g_signal_connect (button_no, "clicked", 
-				G_CALLBACK (set_license_rejected), 
-				GTK_WIDGET (top_widget));
-
+	
 	response = gtk_dialog_run (GTK_DIALOG (top_widget));
-	if (response == GTK_RESPONSE_ACCEPT) {
-		gtk_widget_destroy (top_widget);
-		g_object_unref (xml);
-		return TRUE;
-	}
+	
+	g_free (label_text);
+	g_free (dialog_title);
+
 failed:
 	gtk_widget_destroy (top_widget);
 	g_object_unref (xml);
-	return FALSE;
+	
+	if (response == GTK_RESPONSE_ACCEPT)
+		return TRUE;
+	else
+		return FALSE;
 }
 
 static gboolean
@@ -331,32 +329,43 @@
 mail_account_gui_check_for_license (CamelProvider *prov)
 {
 	GConfClient *gconf;
-	gboolean accepted, status;
-	char *gconf_license_key;
+	gboolean accepted = FALSE, status;
+	GSList * providers_list, *tmp_list;
+	int i;
 
 	if (prov->flags & CAMEL_PROVIDER_HAS_LICENSE) {
 		gconf = mail_config_get_gconf_client ();
-		gconf_license_key = g_strdup_printf (
-			"/apps/evolution/mail/licenses/%s_accepted",
-			prov->license);
 		
-		accepted = gconf_client_get_bool (gconf, gconf_license_key,
-						  NULL);
+		providers_list = gconf_client_get_list (gconf, 
+				"/apps/evolution/mail/licenses", 
+				GCONF_VALUE_STRING, NULL);
+		tmp_list = providers_list;
+		while (tmp_list)
+		{
+			if (!strcmp ((char *)tmp_list->data, prov->protocol)) {
+                                accepted = TRUE;
+                                break;
+                        }
+			tmp_list = g_slist_next (tmp_list);
+		}
 		if (!accepted) {
 			/* Since the license is not yet accepted, pop-up a 
 			 * dialog to display the license agreement and check 
 			 * if the user accepts it
 			 */
 
-			if (display_license (prov->license_file)) {
-				status = gconf_client_set_bool (gconf, 
-						gconf_license_key, TRUE, NULL);
+			if (display_license (prov->license_file, 
+						prov->license_name)) {
+				providers_list = g_slist_append (providers_list,
+						 (gpointer)prov->protocol);
+				status = gconf_client_set_list (gconf, 
+						"/apps/evolution/mail/licenses",
+						GCONF_VALUE_STRING,
+						 providers_list, NULL);
 			} else {
-				g_free (gconf_license_key);
 				return FALSE;
 			}
 		}
-		g_free (gconf_license_key);
 	}
 	return TRUE;
 }
Index: evolution-mail.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
retrieving revision 1.12
diff -u -r1.12 evolution-mail.schemas.in.in
--- evolution-mail.schemas.in.in	10 Apr 2004 00:47:29 -0000	1.12
+++ evolution-mail.schemas.in.in	30 Apr 2004 14:41:39 -0000
@@ -814,5 +814,21 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/evolution/mail/licenses</key>
+      <applyto>/apps/evolution/mail/licenses</applyto>
+      <owner>evolution-mail</owner>
+      <type>list</type>
+      <list_type>string</list_type>
+      <default></default>
+      <locale name="C">
+         <short>List of accepted licenses</short>
+         <long>
+                List of protocol names whose license
+                has been accepted
+         </long>
+      </locale>
+    </schema>
+
   </schemalist>
 </gconfschemafile>
Index: mail-license.glade
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-license.glade,v
retrieving revision 1.1
diff -u -r1.1 mail-license.glade
--- mail-license.glade	23 Apr 2004 06:15:39 -0000	1.1
+++ mail-license.glade	30 Apr 2004 14:41:50 -0000
@@ -5,7 +5,7 @@
 
 <widget class="GtkDialog" id="lic_dialog">
   <property name="visible">True</property>
-  <property name="title" translatable="yes">Exchange Connector License Agreement for Evolution</property>
+  <property name="title" translatable="yes">License Agreement</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
@@ -29,10 +29,10 @@
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">NO</property>
-	      <property name="use_underline">True</property>
+	      <property name="label">gtk-no</property>
+	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
+	      <property name="response_id">-6</property>
 	    </widget>
 	  </child>
 
@@ -41,10 +41,64 @@
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">YES</property>
-	      <property name="use_underline">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
+	      <property name="response_id">-3</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment1">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox1">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image1">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-yes</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label1">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Accept License</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
 	    </widget>
 	  </child>
 	</widget>
@@ -66,8 +120,7 @@
 	    <widget class="GtkLabel" id="lic_top_label">
 	      <property name="visible">True</property>
 	      <property name="label" translatable="yes">
- Please read carefully the license agreement 
- for Evolution Exchange Connector displayed 
+ Please read carefully the license agreement displayed
  below and tick the check box for accepting it
 </property>
 	      <property name="use_underline">False</property>


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