]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Adattamento per nuovi controlli di libgtkform.
authorAndrea Zagli <azagli@libero.it>
Thu, 17 Nov 2011 07:41:31 +0000 (08:41 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 17 Nov 2011 07:41:31 +0000 (08:41 +0100)
.anjuta_sym_db.db
data/libsolipa/gui/libsolipa.ui
src/allegato.c

index 3dbbcb5d8f48a1530b4ba1fbb7d22c95650bc750..1dba8fde0d6281cba3fb69748a36d8e200f6b75e 100644 (file)
Binary files a/.anjuta_sym_db.db and b/.anjuta_sym_db.db differ
index c3a307019f598c883abe95e4364d2b24f677910d..ba25b7743f0482701ab31e5c5eb47dad3ecc2707 100644 (file)
       <object class="GtkTable" id="table22">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="n_rows">4</property>
+        <property name="n_rows">5</property>
         <property name="n_columns">2</property>
         <property name="column_spacing">5</property>
         <property name="row_spacing">5</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="stock">gtk-open</property>
+                    <property name="icon-size">1</property>
                   </object>
                 </child>
               </object>
             <property name="y_options">GTK_FILL</property>
           </packing>
         </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry8">
+            <property name="can_focus">True</property>
+            <property name="editable">False</property>
+            <property name="invisible_char">•</property>
+            <property name="primary_icon_activatable">False</property>
+            <property name="secondary_icon_activatable">False</property>
+            <property name="primary_icon_sensitive">True</property>
+            <property name="secondary_icon_sensitive">True</property>
+          </object>
+          <packing>
+            <property name="top_attach">4</property>
+            <property name="bottom_attach">5</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options">GTK_FILL</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>
index 52f1fbe3b9e3719d83039d7a54d442ed78a70fe6..2dd11705efd3bc76079cdf1f3f618a48d7bf7e7c 100644 (file)
@@ -44,6 +44,9 @@ static void solipa_allegato_get_property (GObject *object,
                                GValue *value,
                                GParamSpec *pspec);
 
+static void solipa_allegato_on_txt_dimensione_nascosto_changed (GtkEditable *editable,
+                                                     gpointer user_data);
+
 static void solipa_allegato_on_file_pulisci (GtkEntry *entry,
                           GtkEntryIconPosition icon_pos,
                           GdkEvent *event,
@@ -68,6 +71,7 @@ struct _SolipaAllegatoPrivate
                GtkWidget *txt_percorso;
                GtkWidget *txt_data;
                GtkWidget *txt_dimensione;
+               GtkWidget *txt_dimensione_nascosto;
                GtkWidget *chk_salva_nel_db;
        };
 
@@ -138,14 +142,19 @@ SolipaAllegato
        priv->txt_percorso = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "entry42"));
        priv->txt_data = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "entry44"));
        priv->txt_dimensione = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "entry45"));
+       priv->txt_dimensione_nascosto = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "entry8"));
        priv->chk_salva_nel_db = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "checkbutton2"));
 
-       g_signal_connect (priv->txt_percorso,
-                         "icon-press", G_CALLBACK (solipa_allegato_on_file_pulisci), (gpointer *)solipa_allegato);
-       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button5"),
-                         "clicked", G_CALLBACK (solipa_allegato_on_btn_apri_clicked), (gpointer *)solipa_allegato);
-       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button144"),
-                         "clicked", G_CALLBACK (solipa_allegato_on_btn_file_clicked), (gpointer *)solipa_allegato);
+       g_signal_connect (priv->txt_dimensione_nascosto, "changed",
+                         G_CALLBACK (solipa_allegato_on_txt_dimensione_nascosto_changed), (gpointer)solipa_allegato);
+
+       g_signal_connect (priv->txt_percorso, "icon-press",
+                         G_CALLBACK (solipa_allegato_on_file_pulisci), (gpointer)solipa_allegato);
+       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button5"), "clicked",
+                         G_CALLBACK (solipa_allegato_on_btn_apri_clicked), (gpointer)solipa_allegato);
+
+       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button144"), "clicked",
+                         G_CALLBACK (solipa_allegato_on_btn_file_clicked), (gpointer)solipa_allegato);
 
        return solipa_allegato;
 }
@@ -209,7 +218,7 @@ solipa_allegato_get_dimensione (SolipaAllegato *solipa_allegato)
 
        priv = SOLIPA_ALLEGATO_GET_PRIVATE (solipa_allegato);
 
-       return strtol (gtk_entry_get_text (GTK_ENTRY (priv->txt_dimensione)), NULL, 10);
+       return strtol (gtk_entry_get_text (GTK_ENTRY (priv->txt_dimensione_nascosto)), NULL, 10);
 }
 
 gboolean
@@ -385,7 +394,7 @@ void solipa_allegato_add_to_gtkform (SolipaAllegato *solipa_allegato, GtkForm *f
        if (dimensione_field != NULL)
                {
                        wentry = gtk_form_widget_entry_new ();
-                       gtk_form_widget_set_from_gtkbuilder (wentry, priv->gtkbuilder, "entry45");
+                       gtk_form_widget_set_from_gtkbuilder (wentry, priv->gtkbuilder, "entry8");
 
                        fint = gtk_form_field_integer_new ();
                        g_object_set (fint,
@@ -404,7 +413,6 @@ solipa_allegato_set_property (GObject *object,
                    GParamSpec *pspec)
 {
        SolipaAllegato *solipa_allegato = (SolipaAllegato *)object;
-
        SolipaAllegatoPrivate *priv = SOLIPA_ALLEGATO_GET_PRIVATE (solipa_allegato);
 
        switch (property_id)
@@ -422,7 +430,6 @@ solipa_allegato_get_property (GObject *object,
                    GParamSpec *pspec)
 {
        SolipaAllegato *solipa_allegato = (SolipaAllegato *)object;
-
        SolipaAllegatoPrivate *priv = SOLIPA_ALLEGATO_GET_PRIVATE (solipa_allegato);
 
        switch (property_id)
@@ -432,6 +439,18 @@ solipa_allegato_get_property (GObject *object,
                                break;
                }
 }
+
+static void
+solipa_allegato_on_txt_dimensione_nascosto_changed (GtkEditable *editable,
+                                         gpointer user_data)
+{
+       SolipaAllegato *allegato = (SolipaAllegato *)user_data;
+       SolipaAllegatoPrivate *priv = SOLIPA_ALLEGATO_GET_PRIVATE (allegato);
+
+       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione),
+                           solipa_format_money (g_strtod (gtk_entry_get_text (GTK_ENTRY (priv->txt_dimensione_nascosto)), NULL), 0, FALSE));
+}
+
 static void
 solipa_allegato_on_file_pulisci (GtkEntry *entry,
                           GtkEntryIconPosition icon_pos,
@@ -443,7 +462,7 @@ solipa_allegato_on_file_pulisci (GtkEntry *entry,
 
        gtk_entry_set_text (GTK_ENTRY (priv->txt_percorso), "");
        gtk_entry_set_text (GTK_ENTRY (priv->txt_data), "");
-       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione), "");
+       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione_nascosto), "0");
 }
 
 static void
@@ -479,7 +498,7 @@ solipa_allegato_on_btn_file_clicked (GtkButton *button,
                                                            g_strdup_printf ("%02d/%02d/%04d %02d.%02d.%02d",
                                                                             tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900,
                                                                             tm->tm_hour, tm->tm_min, tm->tm_sec));
-                                       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione), solipa_format_money (buf.st_size, 0, FALSE));
+                                       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione_nascosto), g_strdup_printf ("%d", buf.st_size));
                                }
                        else
                                {
@@ -495,7 +514,7 @@ solipa_allegato_on_btn_file_clicked (GtkButton *button,
 
                                        gtk_entry_set_text (GTK_ENTRY (priv->txt_percorso), "");
                                        gtk_entry_set_text (GTK_ENTRY (priv->txt_data), "");
-                                       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione), "");
+                                       gtk_entry_set_text (GTK_ENTRY (priv->txt_dimensione_nascosto), "0");
                                }
 
                        g_free (filename);