[Gnucash-changes] Add a new dialog to reset the state of warning
messages.
David Hampton
hampton at cvs.gnucash.org
Sun Jul 17 22:22:38 EDT 2005
Log Message:
-----------
Add a new dialog to reset the state of warning messages.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/gnome/schemas:
apps_gnucash_dialog_common.schemas
gnucash/src/gnome-utils:
Makefile.am
gnc-main-window.c
gnucash/src/gnome-utils/ui:
gnc-main-window-ui.xml
Added Files:
-----------
gnucash/src/gnome-utils:
dialog-reset-warnings.c
dialog-reset-warnings.glade
dialog-reset-warnings.h
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.240
retrieving revision 1.1487.2.241
diff -LChangeLog -LChangeLog -u -r1.1487.2.240 -r1.1487.2.241
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,44 @@
+2005-07-17 David Hampton <hampton at employees.org>
+
+ * src/gnome/schemas/apps_gnucash_dialog_common.schemas:
+ * src/gnome-utils/Makefile.am:
+ * src/gnome-utils/dialog-reset-warnings.[ch]:
+ * src/gnome-utils/dialog-reset-warnings.glade:
+ * src/gnome-utils/gnc-main-window.c:
+ * src/gnome-utils/ui/gnc-main-window-ui.xml: Add a new dialog to
+ reset the state of warning messages.
+
+ * src/gnome-utils/druid-gconf-setup.c: Reset all temporary warning
+ suppressions at startup.
+
+ * src/gnc-ui.h:
+ * src/gnome-utils/gnc-gui-query.c:
+ * src/gnome-utils/gnc-gui-query.glade: New info/question/warning
+ dialogs that remember whether or not the user wants to see them
+ again.
+
+ * src/gnome/gnc-plugin-page-account-tree.c: Add a refresh callback
+ to update the page when preferences change.
+
+ * src/engine/gnc-trace.[ch]: New log module for the
+ preferences/warnings code.
+
+ * src/gnome-utils/gnc-tree-view.c:
+ * src/core-utils/gnc-gconf-utils.[ch]: Add some schema related
+ functions. Remove extraneous argument from
+ gnc_gconf_client_all_entries(). Doxygen updates.
+
+ * src/gnome-utils/gnc-main-window.c:
+ * src/gnome-utils/gnc-window.[ch]: When deleting a window make
+ sure to update the progress bar code. Fixes a crash when you
+ delete the last window and then try to save. From Phil Longstaff
+ <plongstaff at newearth.org>.
+
+ * src/report/standard-reports/equity-statement.scm:
+ * src/report/standard-reports/income-statement.scm: Fix for
+ mispellings in scheme code from Phil Longstaff
+ <plongstaff at newearth.org>.
+
2005-07-15 David Hampton <hampton at employees.org>
* src/gnc-ui.h:
--- /dev/null
+++ src/gnome-utils/dialog-reset-warnings.h
@@ -0,0 +1,23 @@
+/*
+ * dialog-reset-warnings.h -- "Reset Warnings" dialog
+ * Copyright (C) 2005 David Hampton
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 59 Temple Place - Suite 330 Fax: +1-617-542-2652
+ * Boston, MA 02111-1307, USA gnu at gnu.org
+ */
+
+void gnc_reset_warnings_dialog (GtkWidget *main_window);
--- /dev/null
+++ src/gnome-utils/dialog-reset-warnings.glade
@@ -0,0 +1,282 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="Reset Warnings">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Reset Warnings</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="has_separator">True</property>
+ <signal name="response" handler="gnc_reset_warnings_response_cb" last_modification_time="Sun, 17 Jul 2005 01:07:02 GMT"/>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="cancelbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="applybutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-10</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="okbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label65">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">You have requested that the following warning dialogs not be presented. To re-enable any of these dialogs, select the check box next to the dialog, then click OK.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">True</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Select All</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="gnc_reset_warnings_select_all_cb" last_modification_time="Sat, 16 Jul 2005 05:45:06 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button4">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Unselect All</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="gnc_reset_warnings_unselect_all_cb" last_modification_time="Sat, 16 Jul 2005 05:45:25 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="no_warnings">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">No warnings to reset.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="perm_vbox_and_label">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label64">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Permanent Warnings</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="perm_vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="temp_vbox_and_label">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label63">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Temporary Warnings</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="temp_vbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Makefile.am,v
retrieving revision 1.48.2.32
retrieving revision 1.48.2.33
diff -Lsrc/gnome-utils/Makefile.am -Lsrc/gnome-utils/Makefile.am -u -r1.48.2.32 -r1.48.2.33
--- src/gnome-utils/Makefile.am
+++ src/gnome-utils/Makefile.am
@@ -38,6 +38,7 @@
dialog-commodity.c \
dialog-options.c \
dialog-query-list.c \
+ dialog-reset-warnings.c \
dialog-transfer.c \
dialog-utils.c \
druid-utils.c \
@@ -100,6 +101,7 @@
dialog-commodity.h \
dialog-options.h \
dialog-query-list.h \
+ dialog-reset-warnings.h \
dialog-transfer.h \
dialog-utils.h \
druid-utils.h \
@@ -199,10 +201,12 @@
glade_DATA = \
commodity.glade \
dialog-query-list.glade \
+ dialog-reset-warnings.glade \
druid-provider-multifile.glade \
exchange-dialog.glade \
druid-gconf-setup.glade \
gnc-date-format.glade \
+ gnc-gui-query.glade \
preferences.glade \
transfer.glade
--- /dev/null
+++ src/gnome-utils/dialog-reset-warnings.c
@@ -0,0 +1,382 @@
+/*
+ * dialog-reset-warnings.c -- "Resert Warnings" dialog
+ * Copyright (C) 2005 David Hampton
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 59 Temple Place - Suite 330 Fax: +1-617-542-2652
+ * Boston, MA 02111-1307, USA gnu at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+#include "dialog-utils.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-trace.h"
+#include "gnc-ui.h"
+#include "gnc-component-manager.h"
+#include "dialog-reset-warnings.h"
+
+/* This static indicates the debugging module that this .o belongs to. */
+static short module = MOD_PREFS;
+
+#define GCONF_SECTION "dialogs/reset_warnings"
+#define DIALOG_RESET_WARNINGS_CM_CLASS "reset-warnings"
+
+void gnc_reset_warnings_select_all_cb (GtkButton *button, gpointer user_data);
+void gnc_reset_warnings_unselect_all_cb (GtkButton *button, gpointer user_data);
+void gnc_reset_warnings_response_cb (GtkDialog *dialog, gint arg1, gpointer user_data);
+
+
+
+static void
+gnc_reset_warnings_update_widgets (GtkWidget *dialog_widget)
+{
+ GtkWidget *box1, *box2, *nada, *buttons;
+ GtkWidget *ok, *apply;
+ GList *list, *tmp;
+ gboolean any = FALSE, checked = FALSE;
+
+ ENTER(" ");
+ box1 = gnc_glade_lookup_widget(dialog_widget, "perm_vbox_and_label");
+ box2 = gnc_glade_lookup_widget(dialog_widget, "perm_vbox");
+ list = gtk_container_get_children(GTK_CONTAINER(box2));
+ if (list) {
+ gtk_widget_show_all(box1);
+ for (tmp = list; tmp; tmp = g_list_next(tmp)) {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data))) {
+ checked = TRUE;
+ break;
+ }
+ }
+ g_list_free(list);
+ any = TRUE;
+ } else {
+ gtk_widget_hide(box1);
+ }
+
+ box1 = gnc_glade_lookup_widget(dialog_widget, "temp_vbox_and_label");
+ box2 = gnc_glade_lookup_widget(dialog_widget, "temp_vbox");
+ list = gtk_container_get_children(GTK_CONTAINER(box2));
+ if (list) {
+ gtk_widget_show_all(box1);
+ for (tmp = list; tmp; tmp = g_list_next(tmp)) {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tmp->data))) {
+ checked = TRUE;
+ break;
+ }
+ }
+ g_list_free(list);
+ any = TRUE;
+ } else {
+ gtk_widget_hide(box1);
+ }
+
+ nada = gnc_glade_lookup_widget(dialog_widget, "no_warnings");
+ buttons = gnc_glade_lookup_widget(dialog_widget, "hbuttonbox");
+ ok = gnc_glade_lookup_widget(dialog_widget, "okbutton");
+ apply = gnc_glade_lookup_widget(dialog_widget, "applybutton");
+ if (any) {
+ gtk_widget_show(buttons);
+ gtk_widget_hide(nada);
+ gtk_widget_set_sensitive(ok, checked);
+ gtk_widget_set_sensitive(apply, checked);
+ } else {
+ gtk_widget_hide(buttons);
+ gtk_widget_show(nada);
+ gtk_widget_set_sensitive(ok, FALSE);
+ gtk_widget_set_sensitive(apply, FALSE);
+ }
+ LEAVE(" ");
+}
+
+
+static void
+gnc_reset_warnings_select_common (GtkButton *button,
+ gboolean selected)
+{
+ GtkWidget *vbox;
+
+ ENTER("button %p, selected %d", button, selected);
+ vbox = gnc_glade_lookup_widget(GTK_WIDGET(button), "perm_vbox");
+ gtk_container_foreach(GTK_CONTAINER(vbox),
+ (GtkCallback)gtk_toggle_button_set_active,
+ GINT_TO_POINTER(selected));
+ vbox = gnc_glade_lookup_widget(GTK_WIDGET(button), "temp_vbox");
+ gtk_container_foreach(GTK_CONTAINER(vbox),
+ (GtkCallback)gtk_toggle_button_set_active,
+ GINT_TO_POINTER(selected));
+ gnc_reset_warnings_update_widgets(GTK_WIDGET(button));
+ LEAVE(" ");
+}
+
+
+void
+gnc_reset_warnings_select_all_cb (GtkButton *button,
+ gpointer user_data)
+{
+ gnc_reset_warnings_select_common(button, TRUE);
+}
+
+
+void
+gnc_reset_warnings_unselect_all_cb (GtkButton *button,
+ gpointer user_data)
+{
+ gnc_reset_warnings_select_common(button, FALSE);
+}
+
+
+static void
+gnc_reset_warnings_find_remove (GtkWidget *widget,
+ const gchar *name)
+{
+ ENTER("widget %p, name %s", widget, name);
+ if (strcmp(gtk_widget_get_name(widget), name) == 0) {
+ DEBUG("destroying widget %s", name);
+ gtk_widget_destroy(widget);
+ }
+ LEAVE(" ");
+}
+
+
+static void
+gnc_reset_warnings_apply_one (GtkWidget *widget,
+ GtkDialog *dialog)
+{
+ const char *name;
+
+ ENTER("widget %p, dialog %p", widget, dialog);
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+ LEAVE("not active");
+ return;
+ }
+
+ name = gtk_widget_get_name(widget);
+ gnc_gconf_unset(NULL, name, NULL);
+ gtk_widget_destroy(widget);
+ LEAVE(" ");
+}
+
+
+static void
+gnc_reset_warnings_apply_changes (GtkDialog *dialog)
+{
+ GtkWidget *vbox;
+
+ ENTER("dialog %p", dialog);
+ vbox = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "perm_vbox");
+ gtk_container_foreach(GTK_CONTAINER(vbox),
+ (GtkCallback)gnc_reset_warnings_apply_one,
+ dialog);
+ vbox = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "temp_vbox");
+ gtk_container_foreach(GTK_CONTAINER(vbox),
+ (GtkCallback)gnc_reset_warnings_apply_one,
+ dialog);
+ gnc_reset_warnings_update_widgets(GTK_WIDGET(dialog));
+ LEAVE(" ");
+}
+
+
+void
+gnc_reset_warnings_response_cb (GtkDialog *dialog,
+ gint response,
+ gpointer user_data)
+{
+ switch (response) {
+ case GTK_RESPONSE_APPLY:
+ gnc_reset_warnings_apply_changes(dialog);
+ break;
+
+ case GTK_RESPONSE_OK:
+ gnc_reset_warnings_apply_changes(dialog);
+ /* fall through */
+
+ default:
+ gnc_gconf_remove_notification(G_OBJECT(dialog), GCONF_WARNINGS);
+ gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
+ gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS,
+ dialog);
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ break;
+ }
+}
+
+void gnc_reset_warnings_add_one (GConfEntry *entry, GtkWidget *box);
+void
+gnc_reset_warnings_add_one (GConfEntry *entry, GtkWidget *box)
+{
+ const gchar *name, *schema_name, *desc = NULL;
+ GtkWidget *checkbox;
+ GConfSchema *schema = NULL;
+
+ ENTER(" ");
+ name = rindex(entry->key, '/') + 1;
+ schema_name = gconf_entry_get_schema_name(entry);
+ if (schema_name)
+ schema = gnc_gconf_get_schema(NULL, schema_name, NULL);
+ if (schema) {
+ DEBUG("found schema %p", schema);
+ desc = gconf_schema_get_short_desc(schema);
+ DEBUG("description %s", desc);
+ checkbox = gtk_check_button_new_with_label(desc ? desc : name);
+ gconf_schema_free(schema);
+ } else {
+ DEBUG("no schema");
+ checkbox = gtk_check_button_new_with_label(name);
+ }
+
+ gtk_widget_set_name(checkbox, entry->key);
+ g_signal_connect_swapped(G_OBJECT(checkbox), "toggled",
+ (GCallback)gnc_reset_warnings_update_widgets,
+ box);
+ gtk_box_pack_start_defaults(GTK_BOX(box), checkbox);
+ LEAVE(" ");
+}
+
+
+void
+ gnc_reset_warnings_add_section (const gchar *section, GtkWidget *box);
+void
+gnc_reset_warnings_add_section (const gchar *section, GtkWidget *box)
+{
+ GSList *entries, *tmp;
+ GConfEntry *entry;
+
+ ENTER(" ");
+ entries = gnc_gconf_client_all_entries(section);
+ for (tmp = entries; tmp; tmp = g_slist_next(tmp)) {
+ entry = tmp->data;
+ if (gconf_value_get_int(entry->value) != 0) {
+ gnc_reset_warnings_add_one(entry, box);
+ gconf_entry_free(entry);
+ }
+ }
+ g_slist_free(entries);
+
+ LEAVE(" ");
+}
+
+
+static void
+gnc_reset_warnings_gconf_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
+{
+ GtkWidget *dialog, *box;
+ GList *list;
+
+ g_return_if_fail(GTK_IS_DIALOG(user_data));
+
+ ENTER("entry %p, data %p", entry, user_data);
+ dialog = GTK_WIDGET(user_data);
+ DEBUG("entry key '%s', value as %p, value as int %d", entry->key, entry->value, gconf_value_get_int(entry->value));
+
+ /* Which box is affected */
+ if (strstr(entry->key, "permanent") != 0) {
+ box = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "perm_vbox");
+ } else {
+ box = gnc_glade_lookup_widget(GTK_WIDGET(dialog), "temp_vbox");
+ }
+
+ if (gconf_value_get_int(entry->value) != 0) {
+ gnc_reset_warnings_add_one (entry, box);
+ DEBUG("added checkbox for %s", entry->key);
+ } else {
+ /* Don't know is we were invoked by this dialog removing the
+ * warning, or if it happened somewhere else like gconf-editor.
+ * Can't hurt to run the widgets and try to remove it. Worst case
+ * we can't find it because its already been deleted. */
+ list = gtk_container_get_children(GTK_CONTAINER(box));
+ g_list_foreach(list, (GFunc)gnc_reset_warnings_find_remove, entry->key);
+ g_list_free(list);
+ }
+ gnc_reset_warnings_update_widgets(dialog);
+ LEAVE(" ");
+}
+
+
+static gboolean
+show_handler (const char *class, gint component_id,
+ gpointer user_data, gpointer iter_data)
+{
+ GtkWidget *dialog;
+
+ ENTER(" ");
+ dialog = GTK_WIDGET(user_data);
+ gtk_window_present(GTK_WINDOW(dialog));
+ LEAVE(" ");
+ return(TRUE);
+}
+
+
+static void
+close_handler (gpointer user_data)
+{
+ GtkWidget *dialog = user_data;
+
+ ENTER(" ");
+ dialog = GTK_WIDGET(user_data);
+ gnc_unregister_gui_component_by_data(DIALOG_RESET_WARNINGS_CM_CLASS, dialog);
+ gtk_widget_destroy(dialog);
+ LEAVE(" ");
+}
+
+
+void
+gnc_reset_warnings_dialog (GtkWidget *main_window)
+{
+ GtkWidget *dialog, *box;
+ GladeXML *xml;
+
+ ENTER("");
+ if (gnc_forall_gui_components(DIALOG_RESET_WARNINGS_CM_CLASS,
+ show_handler, NULL)) {
+ LEAVE("existing window");
+ return;
+ }
+
+ DEBUG("Opening dialog-reset-warnings.glade:");
+ xml = gnc_glade_xml_new("dialog-reset-warnings.glade", "Reset Warnings");
+ dialog = glade_xml_get_widget(xml, "Reset Warnings");
+ printf("autoconnect\n");
+ glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
+ dialog);
+
+ DEBUG("permanent");
+ box = glade_xml_get_widget(xml, "perm_vbox");
+ gnc_reset_warnings_add_section(GCONF_WARNINGS_PERM, box);
+
+ DEBUG("temporary");
+ box = glade_xml_get_widget(xml, "temp_vbox");
+ gnc_reset_warnings_add_section(GCONF_WARNINGS_TEMP, box);
+
+ gnc_reset_warnings_update_widgets(dialog);
+
+ gnc_gconf_add_notification(G_OBJECT(dialog), GCONF_WARNINGS,
+ gnc_reset_warnings_gconf_changed);
+
+ gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
+
+ gnc_register_gui_component (DIALOG_RESET_WARNINGS_CM_CLASS,
+ NULL, close_handler, dialog);
+
+ gtk_widget_show(dialog);
+ LEAVE(" ");
+}
Index: gnc-main-window.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-main-window.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -Lsrc/gnome-utils/gnc-main-window.c -Lsrc/gnome-utils/gnc-main-window.c -u -r1.1.2.9 -r1.1.2.10
--- src/gnome-utils/gnc-main-window.c
+++ src/gnome-utils/gnc-main-window.c
@@ -33,6 +33,7 @@
#include "gnc-main-window.h"
#include "dialog-options.h"
+#include "dialog-reset-warnings.h"
#include "dialog-transfer.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
@@ -88,6 +89,7 @@
static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_window_move_page (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_window_raise (GtkAction *action, GtkRadioAction *current, GncMainWindow *window);
@@ -167,11 +169,19 @@
G_CALLBACK (gnc_main_window_cmd_edit_preferences) },
/* View menu */
+
{ "ViewRefreshAction", GTK_STOCK_REFRESH, N_("_Refresh"), "<control>r",
N_("Refresh this window"),
G_CALLBACK (gnc_main_window_cmd_view_refresh) },
+ /* Actions menu */
+
+ { "ActionsForgetWarningsAction", NULL, N_("_Reset Warnings..."), NULL,
+ N_("Reset the state of all warning message so they will be shown again."),
+ G_CALLBACK (gnc_main_window_cmd_actions_reset_warnings) },
+
/* Windows menu */
+
{ "WindowNewAction", NULL, N_("_New Window"), NULL,
N_("Open a new top-level GnuCash window."),
G_CALLBACK (gnc_main_window_cmd_window_new) },
@@ -180,6 +190,7 @@
G_CALLBACK (gnc_main_window_cmd_window_move_page) },
/* Help menu */
+
{ "HelpTutorialAction", GNOME_STOCK_BOOK_BLUE, N_("Tutorial and Concepts _Guide"), NULL,
N_("Open the GnuCash Tutorial"),
G_CALLBACK (gnc_main_window_cmd_help_tutorial) },
@@ -191,6 +202,7 @@
G_CALLBACK (gnc_main_window_cmd_help_about) },
/* Misc menu */
+
{ "MiscTestAction", NULL, N_("TEST"), NULL,
N_("Testing stuff"), G_CALLBACK (gnc_main_window_cmd_test) },
@@ -1029,6 +1041,7 @@
GINT_TO_POINTER(1));
}
+ page->window = GTK_WIDGET(window);
page->notebook_page = gnc_plugin_page_create_widget (page);
g_object_set_data (G_OBJECT (page->notebook_page),
PLUGIN_PAGE_LABEL, page);
@@ -1589,6 +1602,12 @@
}
static void
+gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window)
+{
+ gnc_reset_warnings_dialog(GTK_WIDGET(window));
+}
+
+static void
gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window)
{
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))) {
Index: apps_gnucash_dialog_common.schemas
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/schemas/Attic/apps_gnucash_dialog_common.schemas,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -Lsrc/gnome/schemas/apps_gnucash_dialog_common.schemas -Lsrc/gnome/schemas/apps_gnucash_dialog_common.schemas -u -r1.1.2.1 -r1.1.2.2
--- src/gnome/schemas/apps_gnucash_dialog_common.schemas
+++ src/gnome/schemas/apps_gnucash_dialog_common.schemas
@@ -11,6 +11,8 @@
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_editor/window_position</applyto>
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_list/window_position</applyto>
<applyto>/apps/gnucash/dialogs/tax_info/window_position</applyto>
+ <applyto>/apps/gnucash/dialogs/preferences/window_position</applyto>
+ <applyto>/apps/gnucash/dialogs/reset_warnings/window_position</applyto>
<owner>gnucash</owner>
<type>list</type>
<list_type>int</list_type>
@@ -32,6 +34,8 @@
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_editor/window_geometry</applyto>
<applyto>/apps/gnucash/dialogs/scheduled_trans/transaction_list/window_geometry</applyto>
<applyto>/apps/gnucash/dialogs/tax_info/window_geometry</applyto>
+ <applyto>/apps/gnucash/dialogs/preferences/window_geometry</applyto>
+ <applyto>/apps/gnucash/dialogs/reset_warnings/window_geometry</applyto>
<owner>gnucash</owner>
<type>list</type>
<list_type>int</list_type>
Index: gnc-main-window-ui.xml
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/ui/Attic/gnc-main-window-ui.xml,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -Lsrc/gnome-utils/ui/gnc-main-window-ui.xml -Lsrc/gnome-utils/ui/gnc-main-window-ui.xml -u -r1.1.2.3 -r1.1.2.4
--- src/gnome-utils/ui/gnc-main-window-ui.xml
+++ src/gnome-utils/ui/gnc-main-window-ui.xml
@@ -69,6 +69,8 @@
<menu name="Actions" action="ActionsAction">
<placeholder name="ActionsPlaceholder"/>
+ <separator name="ActionSep1"/>
+ <menuitem name="ActionsForgetWarnings" action="ActionsForgetWarningsAction"/>
</menu>
<placeholder name="AdditionalMenusPlaceholder"/>
More information about the gnucash-changes
mailing list