]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Aggiunte le proprietà SolipaMailUI::cc-visible e SolipaMailUI::bcc-visible.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 6 May 2011 08:50:25 +0000 (10:50 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Fri, 6 May 2011 08:50:25 +0000 (10:50 +0200)
src/mailui.c
tests/mailui.c

index 049ee7f548b44dc71c6cab829b874160ab24abb3..5ccf722aacc0e8843878a67bb2d9b7c2b3ef306b 100644 (file)
@@ -33,8 +33,10 @@ enum
        PROP_TO_EDITABLE,
        PROP_CC,
        PROP_CC_EDITABLE,
+       PROP_CC_VISIBLE,
        PROP_BCC,
        PROP_BCC_EDITABLE,
+       PROP_BCC_VISIBLE,
        PROP_SUBJECT,
        PROP_SUBJECT_EDITABLE,
        PROP_BODY,
@@ -74,7 +76,9 @@ struct _SolipaMailUIPrivate
                GtkWidget *from;
                GtkWidget *to;
                GtkWidget *cc;
+               GtkWidget *cc_lbl;
                GtkWidget *bcc;
+               GtkWidget *bcc_lbl;
                GtkWidget *subject;
                GtkWidget *body;
        };
@@ -138,6 +142,13 @@ solipa_mail_ui_class_init (SolipaMailUIClass *klass)
                                                               TRUE,
                                                               G_PARAM_READWRITE));
 
+       g_object_class_install_property (object_class, PROP_CC_VISIBLE,
+                                        g_param_spec_boolean ("cc-visible",
+                                                              "Cc field visible",
+                                                              "Cc field visible",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
        g_object_class_install_property (object_class, PROP_BCC,
                                         g_param_spec_string ("bcc",
                                                              "Bcc",
@@ -152,6 +163,13 @@ solipa_mail_ui_class_init (SolipaMailUIClass *klass)
                                                               TRUE,
                                                               G_PARAM_READWRITE));
 
+       g_object_class_install_property (object_class, PROP_BCC_VISIBLE,
+                                        g_param_spec_boolean ("bcc-visible",
+                                                              "Bcc field visible",
+                                                              "Bcc field visible",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
        g_object_class_install_property (object_class, PROP_SUBJECT,
                                         g_param_spec_string ("subject",
                                                              "Subject",
@@ -270,7 +288,9 @@ SolipaMailUI
        priv->from = GTK_WIDGET (gtk_builder_get_object (builder, "entry3"));
        priv->to = GTK_WIDGET (gtk_builder_get_object (builder, "entry4"));
        priv->cc = GTK_WIDGET (gtk_builder_get_object (builder, "entry6"));
+       priv->cc_lbl = GTK_WIDGET (gtk_builder_get_object (builder, "label11"));
        priv->bcc = GTK_WIDGET (gtk_builder_get_object (builder, "entry7"));
+       priv->bcc_lbl = GTK_WIDGET (gtk_builder_get_object (builder, "label12"));
        priv->subject = GTK_WIDGET (gtk_builder_get_object (builder, "entry5"));
        priv->body = GTK_WIDGET (gtk_builder_get_object (builder, "textview1"));
 
@@ -462,6 +482,19 @@ solipa_mail_ui_set_property (GObject *object,
                                gtk_entry_set_editable (GTK_ENTRY (priv->cc), g_value_get_boolean (value));
                                break;
 
+                       case PROP_CC_VISIBLE:
+                               gtk_widget_set_visible (priv->cc, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->cc_lbl, g_value_get_boolean (value));
+                               if (g_value_get_boolean (value))
+                                       {
+                                               gtk_table_set_row_spacing (GTK_TABLE (priv->widget), 2, 5);
+                                       }
+                               else
+                                       {
+                                               gtk_table_set_row_spacing (GTK_TABLE (priv->widget), 2, 0);
+                                       }
+                               break;
+
                        case PROP_BCC:
                                gtk_entry_set_text (GTK_ENTRY (priv->bcc), g_strstrip (g_value_dup_string (value)));
                                break;
@@ -470,6 +503,19 @@ solipa_mail_ui_set_property (GObject *object,
                                gtk_entry_set_editable (GTK_ENTRY (priv->bcc), g_value_get_boolean (value));
                                break;
 
+                       case PROP_BCC_VISIBLE:
+                               gtk_widget_set_visible (priv->bcc, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->bcc_lbl, g_value_get_boolean (value));
+                               if (g_value_get_boolean (value))
+                                       {
+                                               gtk_table_set_row_spacing (GTK_TABLE (priv->widget), 3, 5);
+                                       }
+                               else
+                                       {
+                                               gtk_table_set_row_spacing (GTK_TABLE (priv->widget), 3, 0);
+                                       }
+                               break;
+
                        case PROP_SUBJECT:
                                gtk_entry_set_text (GTK_ENTRY (priv->subject), g_strstrip (g_value_dup_string (value)));
                                break;
@@ -537,6 +583,10 @@ solipa_mail_ui_get_property (GObject *object,
                                g_value_set_boolean (value, gtk_editable_get_editable (GTK_EDITABLE (priv->cc)));
                                break;
 
+                       case PROP_CC_VISIBLE:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->cc));
+                               break;
+
                        case PROP_BCC:
                                g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (priv->bcc)));
                                break;
@@ -545,6 +595,10 @@ solipa_mail_ui_get_property (GObject *object,
                                g_value_set_boolean (value, gtk_editable_get_editable (GTK_EDITABLE (priv->bcc)));
                                break;
 
+                       case PROP_BCC_VISIBLE:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->bcc));
+                               break;
+
                        case PROP_SUBJECT:
                                g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (priv->subject)));
                                break;
index f49c5689de51fb8fd397f34a7ce29e6e6e12cf41..22b3607757c034a22ebbe5f7dcd91f160d7b5472 100644 (file)
@@ -101,6 +101,8 @@ main (int argc, char *argv[])
                      "from", "a.zagli@comune.scandicci.fi.it",
                      "from-editable", FALSE,
                      "to", "a.zagli@comune.scandicci.fi.it",
+                     "cc-visible", FALSE,
+                     "bcc-visible", FALSE,
                      "subject", "Da SolipaMailUI",
                      "body", "Il body della mail\n"
                              " con a capo\t\te tab\n\nprova prova",