mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-12 17:32:00 -05:00
Add support to four more dialogs to automatically raise an existing
window if the user tries to create a new dialog. Convert ten others to use the new common logic for raising windows. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6810 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
7ffb44f292
commit
5a9fc4329f
13 files changed
+90
-37
No files matched your search
@@ -1914,7 +1914,7 @@ gnc_options_dialog_apply_stub_cb(GtkWidget * w, gpointer data)
|
||||
if (window->apply_cb)
|
||||
window->apply_cb (window, window->apply_cb_data);
|
||||
|
||||
button = button = gnc_options_dialog_get_apply_button (window->container);
|
||||
button = gnc_options_dialog_get_apply_button (window->container);
|
||||
if (button)
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
}
|
||||
@@ -2194,6 +2194,5 @@ gnc_show_options_dialog(void)
|
||||
&options_dialog);
|
||||
}
|
||||
|
||||
gtk_widget_show(options_dialog->container);
|
||||
gdk_window_raise(options_dialog->container->window);
|
||||
gtk_window_present(GTK_WINDOW(options_dialog->container));
|
||||
}
|
||||
@@ -460,6 +460,17 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
gnc_commodities_load_commodities (cd);
|
||||
}
|
||||
|
||||
static void
|
||||
show_handler (const char *class, gint component_id,
|
||||
gpointer user_data, gpointer iter_data)
|
||||
{
|
||||
CommoditiesDialog *cd = user_data;
|
||||
|
||||
if (!cd)
|
||||
return;
|
||||
gtk_window_present (GTK_WINDOW(cd->dialog));
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_commodities_dialog *
|
||||
* opens up a window to edit price information *
|
||||
@@ -473,6 +484,10 @@ gnc_commodities_dialog (GtkWidget * parent)
|
||||
CommoditiesDialog *cd;
|
||||
gint component_id;
|
||||
|
||||
if (gnc_forall_gui_components (DIALOG_COMMODITIES_CM_CLASS,
|
||||
show_handler, NULL))
|
||||
return;
|
||||
|
||||
cd = g_new0 (CommoditiesDialog, 1);
|
||||
|
||||
gnc_commodities_dialog_create (parent, cd);
|
||||
|
||||
@@ -503,6 +503,17 @@ close_handler (gpointer user_data)
|
||||
gnome_dialog_close (GNOME_DIALOG (fcd->dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
show_handler (const char *class, gint component_id,
|
||||
gpointer user_data, gpointer iter_data)
|
||||
{
|
||||
FinCalcDialog *fcd = user_data;
|
||||
|
||||
if (!fcd)
|
||||
return;
|
||||
gtk_window_present (GTK_WINDOW(fcd->dialog));
|
||||
}
|
||||
|
||||
FinCalcDialog *
|
||||
gnc_ui_fincalc_dialog_create(void)
|
||||
{
|
||||
@@ -517,6 +528,10 @@ gnc_ui_fincalc_dialog_create(void)
|
||||
GtkWidget *edit;
|
||||
GladeXML *xml;
|
||||
|
||||
if (gnc_forall_gui_components (DIALOG_FINCALC_CM_CLASS,
|
||||
show_handler, NULL))
|
||||
return;
|
||||
|
||||
commodity = gnc_default_currency ();
|
||||
|
||||
fcd = g_new0(FinCalcDialog, 1);
|
||||
|
||||
@@ -885,7 +885,7 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
|
||||
if (parent != NULL)
|
||||
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (parent));
|
||||
|
||||
/* default to ok */
|
||||
/* default to 'close' button */
|
||||
gnome_dialog_set_default (GNOME_DIALOG(dialog), 0);
|
||||
|
||||
/* price tree */
|
||||
@@ -979,6 +979,23 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
gnc_prices_load_prices (pdb_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
show_handler (const char *class, gint component_id,
|
||||
gpointer user_data, gpointer iter_data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = user_data;
|
||||
|
||||
if (!pdb_dialog)
|
||||
return;
|
||||
|
||||
gtk_window_present (GTK_WINDOW(pdb_dialog->dialog));
|
||||
|
||||
/* Price edit window might not be realized */
|
||||
if (pdb_dialog->price_dialog) {
|
||||
gtk_window_present (GTK_WINDOW(pdb_dialog->price_dialog));
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_prices_dialog *
|
||||
* opens up a window to edit price information *
|
||||
@@ -992,6 +1009,9 @@ gnc_prices_dialog (GtkWidget * parent)
|
||||
PricesDialog *pdb_dialog;
|
||||
gint component_id;
|
||||
|
||||
if (gnc_forall_gui_components (DIALOG_PRICES_CM_CLASS, show_handler, NULL))
|
||||
return;
|
||||
|
||||
pdb_dialog = g_new0 (PricesDialog, 1);
|
||||
|
||||
gnc_prices_dialog_create (parent, pdb_dialog);
|
||||
|
||||
@@ -551,8 +551,7 @@ gnc_ui_scheduled_xaction_dialog_create(void)
|
||||
(gpointer)sxd );
|
||||
if ( alreadyExisting != NULL ) {
|
||||
sxd = (SchedXactionDialog*)alreadyExisting->data;
|
||||
gtk_widget_show( sxd->dialog );
|
||||
gdk_window_raise( sxd->dialog->window );
|
||||
gtk_window_present( GTK_WINDOW(sxd->dialog) );
|
||||
g_list_free( alreadyExisting );
|
||||
return sxd;
|
||||
}
|
||||
@@ -723,8 +722,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
sx );
|
||||
if ( alreadyExists ) {
|
||||
sxed = (SchedXactionEditorDialog*)alreadyExists->data;
|
||||
gtk_widget_show( sxed->dialog );
|
||||
gdk_window_raise( sxed->dialog->window );
|
||||
gtk_window_present( GTK_WINDOW(sxed->dialog) );
|
||||
g_list_free( alreadyExists );
|
||||
return sxed;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <gnome.h>
|
||||
|
||||
#include "dialog-totd.h"
|
||||
#include "dialog-utils.h" /* remove with GTK 2.0 */
|
||||
#include "global-options.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "gnc-ui.h"
|
||||
@@ -76,7 +77,7 @@ void gnc_ui_totd_dialog_create_and_run(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_window_raise(win->window);
|
||||
gtk_window_present(GTK_WINDOW(win));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1112,8 +1112,8 @@ gnc_acct_tree_window_toolbar_options_cb(GtkWidget * widget, gpointer data) {
|
||||
GNCAcctTreeWin * win = data;
|
||||
|
||||
if(win->editor_dialog) {
|
||||
gdk_window_raise(GTK_WIDGET
|
||||
(gnc_options_dialog_widget(win->editor_dialog))->window);
|
||||
gtk_window_present(GTK_WINDOW
|
||||
(gnc_options_dialog_widget(win->editor_dialog)));
|
||||
}
|
||||
else {
|
||||
win->editor_dialog = gnc_options_dialog_new(TRUE, NULL);
|
||||
|
||||
@@ -2008,12 +2008,7 @@ gnc_ui_reconcile_window_raise(RecnWindow * recnData)
|
||||
if (recnData->window == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_show(recnData->window);
|
||||
|
||||
if (recnData->window->window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_raise(recnData->window->window);
|
||||
gtk_window_present(GTK_WINDOW(recnData->window));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,12 +213,7 @@ gnc_register_raise (RegWindow *regData)
|
||||
if (regData->window == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_show (regData->window);
|
||||
|
||||
if (regData->window->window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_raise (regData->window->window);
|
||||
gtk_window_present (GTK_WINDOW(regData->window));
|
||||
}
|
||||
|
||||
|
||||
@@ -671,8 +666,7 @@ gnc_register_show_date_window(RegWindow *regData)
|
||||
if (regDateData->window == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_show_all(regDateData->window);
|
||||
gdk_window_raise(GTK_WIDGET(regDateData->window)->window);
|
||||
gtk_window_present(GTK_WINDOW(regDateData->window));
|
||||
}
|
||||
|
||||
static RegDateWindow *
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
|
||||
#define DRUID_QIF_IMPORT_CM_CLASS "druid-qif-import"
|
||||
|
||||
struct _qifimportwindow {
|
||||
GtkWidget * window;
|
||||
GtkWidget * druid;
|
||||
@@ -145,6 +147,8 @@ gnc_ui_qif_import_druid_destroy (QIFImportWindow * window) {
|
||||
|
||||
/* FIXME -- commodity pages */
|
||||
|
||||
gnc_unregister_gui_component_by_data(DRUID_QIF_IMPORT_CM_CLASS, window);
|
||||
|
||||
gtk_widget_destroy(window->window);
|
||||
|
||||
scm_unprotect_object(window->imported_files);
|
||||
@@ -1679,9 +1683,24 @@ gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w) {
|
||||
|
||||
/* ======================================================== */
|
||||
|
||||
static void
|
||||
show_handler (const char *class, gint component_id,
|
||||
gpointer user_data, gpointer iter_data)
|
||||
{
|
||||
QIFImportWindow *qif_win = user_data;
|
||||
|
||||
if (!qif_win)
|
||||
return;
|
||||
gtk_window_present (GTK_WINDOW(qif_win->window));
|
||||
}
|
||||
|
||||
void
|
||||
gnc_file_qif_import (void)
|
||||
{
|
||||
if (gnc_forall_gui_components (DRUID_QIF_IMPORT_CM_CLASS,
|
||||
show_handler, NULL))
|
||||
return;
|
||||
|
||||
/* pop up the QIF File Import dialog box */
|
||||
gnc_ui_qif_import_druid_make();
|
||||
}
|
||||
@@ -1919,8 +1938,10 @@ gnc_ui_qif_import_druid_make(void) {
|
||||
|
||||
gnc_druid_set_colors (GNOME_DRUID (retval->druid));
|
||||
|
||||
gnc_register_gui_component(DRUID_QIF_IMPORT_CM_CLASS, NULL, NULL, retval);
|
||||
|
||||
gtk_widget_show_all(retval->window);
|
||||
gdk_window_raise (retval->window->window);
|
||||
gtk_window_present (GTK_WINDOW(retval->window));
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -258,12 +258,7 @@ gnc_register_raise (GNCRegWidget *rw)
|
||||
if (rw->window == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_show (rw->window);
|
||||
|
||||
if (rw->window->window == NULL)
|
||||
return;
|
||||
|
||||
gdk_window_raise (rw->window->window);
|
||||
gtk_window_present (GTK_WINDOW(rw->window));
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
|
||||
@@ -220,8 +220,8 @@ gnc_column_view_edit_options(SCM options, SCM view) {
|
||||
|
||||
ptr = gh_call1(get_editor, view);
|
||||
if(ptr != SCM_BOOL_F) {
|
||||
GtkWidget * w = gw_wcp_get_ptr(ptr);
|
||||
gdk_window_raise(GTK_WIDGET(w)->window);
|
||||
GtkWindow * w = gw_wcp_get_ptr(ptr);
|
||||
gtk_window_present(w);
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1014,8 +1014,8 @@ gnc_report_window_default_params_editor(SCM options, SCM report)
|
||||
|
||||
ptr = gh_call1(get_editor, report);
|
||||
if(ptr != SCM_BOOL_F) {
|
||||
GtkWidget * w = gw_wcp_get_ptr(ptr);
|
||||
gdk_window_raise(GTK_WIDGET(w)->window);
|
||||
GtkWindow * w = gw_wcp_get_ptr(ptr);
|
||||
gtk_window_present(w);
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -1075,7 +1075,7 @@ void
|
||||
gnc_report_raise_editor(SCM report) {
|
||||
SCM get_editor = gh_eval_str("gnc:report-editor-widget");
|
||||
SCM editor = gh_call1(get_editor, report);
|
||||
gdk_window_raise(GTK_WIDGET(gw_wcp_get_ptr(editor))->window);
|
||||
gtk_window_present(gw_wcp_get_ptr(editor));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
Reference in new issue
Block a user