]> saetta.ns0.it Git - zakaudit/gui/commitdiff
Adjustments.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 6 Jun 2011 09:10:00 +0000 (11:10 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 6 Jun 2011 09:10:00 +0000 (11:10 +0200)
Made transient the progress window.
Sorted the combo with tables list.

src/datasources.c
src/table.c

index acc5a752c3844af7a07ac20f162d46fd77796d5d..fb7d570d2434932e22220921bffd46e24575e9fc 100644 (file)
@@ -277,6 +277,7 @@ datasources_add_all_tables (Datasources *datasources)
                        if (id_ds != 0)
                                {
                                        dialog = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_progress"));
+                                       gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")));
 
                                        /* updating meta store */
                                        priv->update_metastore_datasource_id = id_ds;
index 11b061a28ed2ca9264056effbd3e7a02ebaaf41a..2ceb37a86846de7b8fee1279559ac18c583fefae 100644 (file)
@@ -65,6 +65,7 @@ struct _TablePrivate
 
                GtkWidget *w;
                GtkListStore *lstore_fields;
+               GtkTreeModel *cb_model;
 
                gint id;
 
@@ -131,9 +132,9 @@ Table
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit ("lstore_tables"
-                                                                                      "|lstore_fields"
+                                                      "|lstore_fields"
                                                       "|w_progress"
-                                                                                                  "|w_table",
+                                                      "|w_table",
                                                       "|", -1),
                                           &error);
        if (error != NULL)
@@ -144,6 +145,7 @@ Table
 
        priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_table"));
        priv->lstore_fields = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_fields"));
+       priv->cb_model = gtk_combo_box_get_model (GTK_COMBO_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "combobox1")));
 
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "combobox1"),
                          "changed", G_CALLBACK (table_on_cb_tables_changed), (gpointer *)a);
@@ -273,11 +275,10 @@ table_load_db_tables (Table *table)
 
        TablePrivate *priv = TABLE_GET_PRIVATE (table);
 
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "combobox1")));
-
-       gtk_list_store_clear (GTK_LIST_STORE (model));
+       gtk_list_store_clear (GTK_LIST_STORE (priv->cb_model));
 
        dialog = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_progress"));
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")));
 
        /* updating meta store */
        priv->update_metastore_datasource_id = strtol (gtk_label_get_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label8"))), NULL, 10);
@@ -286,25 +287,25 @@ table_load_db_tables (Table *table)
 
        error = NULL;
        thr = g_thread_create (table_update_metastore,
-                                  (gpointer)table,
-                                  FALSE,
-                                  &error);
+                              (gpointer)table,
+                              FALSE,
+                              &error);
        if (thr == NULL || error != NULL)
                {
                        gtk_widget_hide_all (dialog);
                        dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                    GTK_MESSAGE_WARNING,
-                                                                    GTK_BUTTONS_OK,
-                                                                    "Unable to update the metastore: %s",
-                                                            error != NULL && error->message != NULL ? error->message : "no details");
+                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                        GTK_MESSAGE_WARNING,
+                                                        GTK_BUTTONS_OK,
+                                                        "Unable to update the metastore: %s",
+                                                        error != NULL && error->message != NULL ? error->message : "no details");
                        gtk_dialog_run (GTK_DIALOG (dialog));
                        gtk_widget_destroy (dialog);
                        return;
                }
 
        gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")),
-                               "Updating meta store");
+                           "Updating meta store");
        gtk_widget_show_all (dialog);
        gtk_widget_show_now (dialog);
 
@@ -319,10 +320,10 @@ table_load_db_tables (Table *table)
                {
                        gtk_widget_hide_all (dialog);
                        dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                    GTK_MESSAGE_WARNING,
-                                                                    GTK_BUTTONS_OK,
-                                                                    priv->error_update_metastore);
+                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                        GTK_MESSAGE_WARNING,
+                                                        GTK_BUTTONS_OK,
+                                                        priv->error_update_metastore);
                        gtk_dialog_run (GTK_DIALOG (dialog));
                        gtk_widget_destroy (dialog);
                        return;
@@ -343,13 +344,17 @@ table_load_db_tables (Table *table)
 
                                        if (!table_is_a_system_table (priv->commons, table_name))
                                                {
-                                                       gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-                                                       gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                                       gtk_list_store_append (GTK_LIST_STORE (priv->cb_model), &iter);
+                                                       gtk_list_store_set (GTK_LIST_STORE (priv->cb_model), &iter,
                                                                            0, table_name,
                                                                            -1);
                                                }
                                }
                        g_object_unref (dm);
+
+                       model = gtk_tree_model_sort_new_with_model (priv->cb_model);
+                       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0, GTK_SORT_ASCENDING);
+                       gtk_combo_box_set_model (GTK_COMBO_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "combobox1")), model);
                }
        else
                {