diff options
author | Sarfraaz Ahmed <asarfraaz@novell.com> | 2004-05-04 18:58:43 +0800 |
---|---|---|
committer | Ahmed Sarfraaz <sarfraaz@src.gnome.org> | 2004-05-04 18:58:43 +0800 |
commit | e8ac12faff8b51a2018d38f367e39a6c6fd171bb (patch) | |
tree | ec00ba42065ef5bd2d6a16a2f7ed3d1e97640cac | |
parent | 882a8952b44e104e0190d7997807de29b8cf6912 (diff) | |
download | gsoc2013-evolution-e8ac12faff8b51a2018d38f367e39a6c6fd171bb.tar.gz gsoc2013-evolution-e8ac12faff8b51a2018d38f367e39a6c6fd171bb.tar.zst gsoc2013-evolution-e8ac12faff8b51a2018d38f367e39a6c6fd171bb.zip |
This now takes CamelProvider as argument. Made the display message more
2004-05-04 Sarfraaz Ahmed <asarfraaz@novell.com>
* mail-account-gui.c (display_license): This now takes CamelProvider
as argument. Made the display message more generic. Removed the signal
connects for buttons and replaced those with proper gtk_reponses.
(mail_account_gui_check_for_license): Modified the gconf key for
licenses to be a string list.
* evolution-mail.schemas.in.in: Added the gconf schema entry for a
string list to handle the component names whose licenses are accepted.
* mail-license.glade: Modified the display string and added the
appropriate gtk_response types for the buttons.
svn path=/trunk/; revision=25783
-rw-r--r-- | mail/ChangeLog | 13 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in.in | 16 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 93 | ||||
-rw-r--r-- | mail/mail-license.glade | 71 |
4 files changed, 138 insertions, 55 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 16f32343b7..0928fe5832 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2004-05-04 Sarfraaz Ahmed <asarfraaz@novell.com> + + * mail-account-gui.c (display_license): This now takes CamelProvider + as argument. Made the display message more generic. Removed the signal + connects for buttons and replaced those with proper gtk_reponses. + (mail_account_gui_check_for_license): Modified the gconf key for + licenses to be a string list. + * evolution-mail.schemas.in.in: Added the gconf schema entry for a + string list to handle the component names whose licenses are accepted. + * mail-license.glade: Modified the display string and added the + appropriate gtk_response types for the buttons. + + 2004-05-03 Jeffrey Stedfast <fejj@ximian.com> Fix for bug #57968 diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index 6327985609..01f10052d7 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -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> diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 85af00c601..e2fdf8955b 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -168,21 +168,6 @@ auto_detected_foreach (gpointer key, gpointer value, gpointer user_data) 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) { @@ -228,14 +213,16 @@ populate_text_entry (GtkTextView *view, const char *filename) } static gboolean -display_license(const char *filename) +display_license (CamelProvider *prov) { GladeXML *xml; GtkWidget *top_widget; GtkTextView *text_entry; GtkButton *button_yes, *button_no; GtkCheckButton *check_button; - GtkResponseType response; + GtkResponseType response = GTK_RESPONSE_NONE; + GtkLabel *top_label; + char *label_text, *dialog_title; gboolean status; xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-license.glade", @@ -243,7 +230,7 @@ display_license(const char *filename) top_widget = glade_xml_get_widget (xml, "lic_dialog"); text_entry = GTK_TEXT_VIEW (glade_xml_get_widget (xml, "textview1")); - status = populate_text_entry (GTK_TEXT_VIEW (text_entry), filename); + status = populate_text_entry (GTK_TEXT_VIEW (text_entry), prov->license_file); if (!status) goto failed; @@ -257,25 +244,31 @@ display_license(const char *filename) 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 (_("\n Please read carefully the license agreement\n" + " for %s displayed below\n" + " and tick the check box for accepting it\n"), prov->license_name); + + gtk_label_set_label (top_label, label_text); + + dialog_title = g_strdup_printf (_("%s License Agreement"), prov->license_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; + + return (response == GTK_RESPONSE_ACCEPT); } static gboolean @@ -342,34 +335,42 @@ static gboolean mail_account_gui_check_for_license (CamelProvider *prov) { GConfClient *gconf; - gboolean accepted, status; - char *gconf_license_key; + gboolean accepted = TRUE, status; + GSList * providers_list, *l, *n; + char *provider; 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); + + for (l = providers_list, accepted = FALSE; l && !accepted; l = g_slist_next (l)) + accepted = (strcmp ((char *)l->data, prov->protocol) == 0); 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); - } else { - g_free (gconf_license_key); - return FALSE; + if ((accepted = display_license (prov)) == TRUE) { + provider = g_strdup (prov->protocol); + providers_list = g_slist_append (providers_list, + provider); + status = gconf_client_set_list (gconf, + "/apps/evolution/mail/licenses", + GCONF_VALUE_STRING, + providers_list, NULL); } } - g_free (gconf_license_key); + l = providers_list; + while (l) { + n = g_slist_next (l); + g_free (l->data); + g_slist_free_1 (l); + l = n; + } } - return TRUE; + return accepted; } gboolean diff --git a/mail/mail-license.glade b/mail/mail-license.glade index 01fc3e8d9d..a74f611d2d 100644 --- a/mail/mail-license.glade +++ b/mail/mail-license.glade @@ -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> |