diff --git a/gnucash/gnome/dialog-price-edit-db.c b/gnucash/gnome/dialog-price-edit-db.c index 602a9cd43f..93285a07e0 100644 --- a/gnucash/gnome/dialog-price-edit-db.c +++ b/gnucash/gnome/dialog-price-edit-db.c @@ -62,7 +62,6 @@ static QofLogModule log_module = GNC_MOD_GUI; void gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data); void gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data); -void gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data); void gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data); void gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data); void gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data); @@ -72,7 +71,7 @@ void gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data); typedef struct { - GtkWidget * dialog; + GtkWidget * window; QofSession *session; QofBook *book; GNCPriceDB *price_db; @@ -96,10 +95,10 @@ gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data) ENTER(" "); gnc_unregister_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog); - if (pdb_dialog->dialog) + if (pdb_dialog->window) { - gtk_widget_destroy(pdb_dialog->dialog); - pdb_dialog->dialog = NULL; + gtk_widget_destroy(pdb_dialog->window); + pdb_dialog->window = NULL; } g_free (pdb_dialog); @@ -118,17 +117,6 @@ gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data) } -void -gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data) -{ - PricesDialog *pdb_dialog = data; - - ENTER(" "); - gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog); - LEAVE(" "); -} - - void gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data) { @@ -149,7 +137,7 @@ gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data) return; } - gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session, + gnc_price_edit_dialog (pdb_dialog->window, pdb_dialog->session, price_list->data, GNC_PRICE_EDIT); g_list_free(price_list); LEAVE(" "); @@ -190,7 +178,7 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data) "Are you sure you want to delete the %d selected prices?", length), length); - dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog), + dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, @@ -378,7 +366,6 @@ get_fiscal_end_date (void) PINFO("Fiscal end date is %s", datebuff); return time64_to_gdate (end); - } void @@ -435,7 +422,7 @@ gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data) gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog); - gtk_window_set_transient_for (GTK_WINDOW (pdb_dialog->remove_dialog), GTK_WINDOW (pdb_dialog->dialog)); + gtk_window_set_transient_for (GTK_WINDOW (pdb_dialog->remove_dialog), GTK_WINDOW (pdb_dialog->window)); pdb_dialog->remove_source = 9; // FQ and Commodities highlighted button = GTK_WIDGET(gtk_builder_get_object (builder, "checkbutton_fq")); @@ -533,7 +520,7 @@ gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data) price = price_list->data; g_list_free(price_list); } - gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session, + gnc_price_edit_dialog (pdb_dialog->window, pdb_dialog->session, price, GNC_PRICE_NEW); LEAVE(" "); } @@ -562,7 +549,7 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data) return; } - scm_window = SWIG_NewPointerObj(pdb_dialog->dialog, + scm_window = SWIG_NewPointerObj(pdb_dialog->window, SWIG_TypeQuery("_p_GtkWindow"), 0); gnc_set_busy_cursor (NULL, TRUE); @@ -670,32 +657,25 @@ row_activated_cb (GtkTreeView *view, GtkTreePath *path, static void gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog) { - GtkWidget *dialog, *scrolled_window; + GtkWidget *window, *scrolled_window; GtkBuilder *builder; GtkTreeView *view; GtkTreeSelection *selection; ENTER(" "); builder = gtk_builder_new(); - gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_dialog"); + gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_window"); - dialog = GTK_WIDGET(gtk_builder_get_object (builder, "prices_dialog")); - pdb_dialog->dialog = dialog; + window = GTK_WIDGET(gtk_builder_get_object (builder, "prices_window")); + pdb_dialog->window = window; // Set the style context for this dialog so it can be easily manipulated with css - gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPriceEditDialog"); + gnc_widget_set_style_context (GTK_WIDGET(window), "GncPriceEditDialog"); pdb_dialog->session = gnc_get_current_session(); pdb_dialog->book = qof_session_get_book(pdb_dialog->session); pdb_dialog->price_db = gnc_pricedb_get_db(pdb_dialog->book); - /* parent */ - if (parent != NULL) - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); - - /* default to 'close' button */ - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); - /* price tree */ scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "price_list_window")); view = gnc_tree_view_price_new(pdb_dialog->book, @@ -733,13 +713,20 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog) button = GTK_WIDGET(gtk_builder_get_object (builder, "get_quotes_button")); gtk_widget_set_sensitive(button, FALSE); } + /* default to 'close' button */ + button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button")); + gtk_widget_grab_default (button); + gtk_widget_grab_focus (button); + } - gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog); + g_signal_connect (pdb_dialog->window, "destroy", + G_CALLBACK(gnc_prices_dialog_window_destroy_cb), pdb_dialog); + gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog); g_object_unref(G_OBJECT(builder)); - gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog), GTK_WINDOW (parent)); + gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->window), GTK_WINDOW (parent)); LEAVE(" "); } @@ -750,9 +737,9 @@ close_handler (gpointer user_data) PricesDialog *pdb_dialog = user_data; ENTER(" "); - gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog)); + gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->window)); - gtk_widget_destroy (GTK_WIDGET (pdb_dialog->dialog)); + gtk_widget_destroy (GTK_WIDGET (pdb_dialog->window)); LEAVE(" "); } @@ -778,7 +765,7 @@ show_handler (const char *klass, gint component_id, return(FALSE); } - gtk_window_present (GTK_WINDOW(pdb_dialog->dialog)); + gtk_window_present (GTK_WINDOW(pdb_dialog->window)); LEAVE(" "); return(TRUE); } @@ -815,6 +802,6 @@ gnc_prices_dialog (GtkWidget * parent) gtk_widget_grab_focus (GTK_WIDGET(pdb_dialog->price_tree)); - gtk_widget_show (pdb_dialog->dialog); + gtk_widget_show (pdb_dialog->window); LEAVE(" "); } diff --git a/gnucash/gtkbuilder/dialog-price.glade b/gnucash/gtkbuilder/dialog-price.glade index e09c6ccb97..6d33455f9b 100644 --- a/gnucash/gtkbuilder/dialog-price.glade +++ b/gnucash/gtkbuilder/dialog-price.glade @@ -1,5 +1,5 @@ - + @@ -54,6 +54,9 @@ True dialog + + + True @@ -366,6 +369,9 @@ Remove Old Prices 500 dialog + + + True @@ -778,64 +784,30 @@ These prices were added so that there's always a "nearest in time" price for eve ok_button - + False - 6 Price Database - 400 + 800 400 - normal - - - - - + + + + + True False - 6 - - - True - False - end - - - _Close - True - True - True - False - True - - - False - False - 0 - - - - - False - True - end - 0 - - - + True False True - False + True True True 3 in - - - True @@ -844,22 +816,106 @@ These prices were added so that there's always a "nearest in time" price for eve - + True False - 5 + 12 vertical - spread - - _Get Quotes + True - True - True - False - Get new online quotes for stock accounts. - True - + False + 5 + vertical + 12 + start + + + _Add + True + True + True + False + Add a new price. + True + + + + False + False + 0 + + + + + _Remove + True + False + True + True + False + Remove the current price. + True + + + + False + False + 1 + + + + + _Edit + True + False + True + True + False + Edit the current price. + True + + + + False + False + 2 + + + + + Remove _Old + True + True + True + False + Remove prices older than a user-entered date. + True + + + + False + False + 3 + + + + + _Get Quotes + True + True + True + False + Get new online quotes for stock accounts. + True + + + + False + False + 4 + + True @@ -868,93 +924,52 @@ These prices were added so that there's always a "nearest in time" price for eve - - _Add + True - True - True - False - Add a new price. - True - + False + end + 5 + vertical + start + + + _Close + True + True + True + False + start + True + + + + False + False + 0 + + False - False - 0 - - - - - _Remove - True - False - True - True - False - Remove the current price. - True - - - - False - False + True 1 - - - _Edit - True - False - True - True - False - Edit the current price. - True - - - - False - False - 2 - - - - - Remove _Old - True - True - True - False - Remove prices older than a user-entered date. - True - - - - False - False - 3 - - False True - 1 + 2 True True - 2 + 0 - - close_button -