mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Minor code cleanup and consolidations.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13375 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e706e3f023
commit
fa8cae90e1
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2006-02-23 David Hampton <hampton@employees.org>
|
||||||
|
|
||||||
|
* src/report/report-gnome/gnc-plugin-page-report.c:
|
||||||
|
* src/gnome-utils/gnc-recurrence.c:
|
||||||
|
* src/gnome-utils/gnc-plugin-file-history.c:
|
||||||
|
* src/gnome-utils/gnc-main-window.c:
|
||||||
|
* src/gnome-utils/gnc-plugin-page.[ch]:
|
||||||
|
* src/gnome-utils/dialog-commodity.c:
|
||||||
|
* src/gnome/gnc-plugin-page-register.c: Minor code cleanup and
|
||||||
|
consolidations.
|
||||||
|
|
||||||
2006-02-23 Joshua Sled <jsled@asynchronous.org>
|
2006-02-23 Joshua Sled <jsled@asynchronous.org>
|
||||||
|
|
||||||
* gentoo/gnucash-1.9.x.ebuild: Add ebuild for gnucash 1.9/2.0 series.
|
* gentoo/gnucash-1.9.x.ebuild: Add ebuild for gnucash 1.9/2.0 series.
|
||||||
|
@ -532,7 +532,7 @@ gnc_set_commodity_section_sensitivity (GtkWidget *widget, gpointer user_data)
|
|||||||
|
|
||||||
if ((offset < cw->comm_section_top) || (offset >= cw->comm_section_bottom))
|
if ((offset < cw->comm_section_top) || (offset >= cw->comm_section_bottom))
|
||||||
return;
|
return;
|
||||||
g_object_set(widget, "sensitive", !cw->is_currency, NULL);
|
gtk_widget_set_sensitive(widget, !cw->is_currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2501,7 +2501,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
|
|||||||
|
|
||||||
action = gtk_action_group_get_action(priv->action_group,
|
action = gtk_action_group_get_action(priv->action_group,
|
||||||
"ExtensionsAction");
|
"ExtensionsAction");
|
||||||
g_object_set(G_OBJECT(action), "visible", FALSE, (char *)NULL);
|
gtk_action_set_visible(action, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GncPluginManager stuff */
|
/* GncPluginManager stuff */
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
|
#include "gtk-compat.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gnc-file.h"
|
#include "gnc-file.h"
|
||||||
@ -316,7 +317,7 @@ gnc_history_update_action (GncMainWindow *window,
|
|||||||
g_free(old_filename);
|
g_free(old_filename);
|
||||||
g_object_set_data(G_OBJECT(action), FILENAME_STRING, g_strdup(filename));
|
g_object_set_data(G_OBJECT(action), FILENAME_STRING, g_strdup(filename));
|
||||||
} else {
|
} else {
|
||||||
g_object_set(G_OBJECT(action), "visible", FALSE, NULL);
|
gtk_action_set_visible(action, FALSE);
|
||||||
}
|
}
|
||||||
g_free(action_name);
|
g_free(action_name);
|
||||||
LEAVE("");
|
LEAVE("");
|
||||||
|
@ -300,6 +300,21 @@ gnc_plugin_page_unmerge_actions (GncPluginPage *page,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkAction *
|
||||||
|
gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name)
|
||||||
|
{
|
||||||
|
GncPluginPagePrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), NULL);
|
||||||
|
g_return_val_if_fail(name != NULL, NULL);
|
||||||
|
|
||||||
|
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
|
||||||
|
if (!priv->action_group)
|
||||||
|
return NULL;
|
||||||
|
return gtk_action_group_get_action (priv->action_group, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Retrieve the textual name of a plugin. */
|
/* Retrieve the textual name of a plugin. */
|
||||||
const gchar *
|
const gchar *
|
||||||
gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
|
gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)
|
||||||
|
@ -451,6 +451,15 @@ GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
|
|||||||
GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
|
GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
|
||||||
const gchar *group_name);
|
const gchar *group_name);
|
||||||
|
|
||||||
|
/** Retrieve a GtkAction object associated with this page.
|
||||||
|
*
|
||||||
|
* @param page The page whose menu/toolbar action group should be
|
||||||
|
* retrieved.
|
||||||
|
*
|
||||||
|
* @param name The name of the GtkAction to find.
|
||||||
|
*
|
||||||
|
* @return A pointer to the retuested GtkAction object or NULL. */
|
||||||
|
GtkAction *gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name);
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void gnc_plugin_page_inserted (GncPluginPage *plugin_page);
|
void gnc_plugin_page_inserted (GncPluginPage *plugin_page);
|
||||||
|
@ -393,8 +393,7 @@ static void addRecurrence(GncRecurrenceComp *grc, GncRecurrence *gr)
|
|||||||
G_CALLBACK(grc_changed), grc );
|
G_CALLBACK(grc_changed), grc );
|
||||||
grc->num_rec++;
|
grc->num_rec++;
|
||||||
|
|
||||||
g_object_set(G_OBJECT(grc->buttRemove), "sensitive",
|
gtk_widget_set_sensitive(GTK_WIDGET(grc->buttRemove), (grc->num_rec > 1));
|
||||||
(grc->num_rec > 1), NULL);
|
|
||||||
g_signal_emit_by_name(G_OBJECT(grc), "changed", NULL);
|
g_signal_emit_by_name(G_OBJECT(grc), "changed", NULL);
|
||||||
|
|
||||||
|
|
||||||
@ -412,8 +411,7 @@ static void removeRecurrence(GncRecurrenceComp *grc)
|
|||||||
g_signal_emit_by_name(G_OBJECT(grc), "changed", NULL);
|
g_signal_emit_by_name(G_OBJECT(grc), "changed", NULL);
|
||||||
|
|
||||||
|
|
||||||
g_object_set(G_OBJECT(grc->buttRemove), "sensitive",
|
gtk_widget_set_sensitive(GTK_WIDGET(grc->buttRemove), (grc->num_rec > 1));
|
||||||
(grc->num_rec > 1), NULL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,15 +588,12 @@ gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
|
|||||||
static void
|
static void
|
||||||
gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageRegister *page)
|
gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageRegister *page)
|
||||||
{
|
{
|
||||||
GtkActionGroup *action_group;
|
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
gboolean expanded;
|
gboolean expanded;
|
||||||
|
|
||||||
expanded = gnc_split_register_current_trans_expanded(reg);
|
expanded = gnc_split_register_current_trans_expanded(reg);
|
||||||
|
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
|
||||||
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
|
"SplitTransactionAction");
|
||||||
action = gtk_action_group_get_action (action_group,
|
|
||||||
"SplitTransactionAction");
|
|
||||||
|
|
||||||
g_signal_handlers_block_by_func
|
g_signal_handlers_block_by_func
|
||||||
(action, gnc_plugin_page_register_cmd_expand_transaction, page);
|
(action, gnc_plugin_page_register_cmd_expand_transaction, page);
|
||||||
@ -608,12 +605,10 @@ gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageR
|
|||||||
static void
|
static void
|
||||||
gnc_plugin_page_register_update_toolbar (SplitRegister *reg, GncPluginPageRegister *page)
|
gnc_plugin_page_register_update_toolbar (SplitRegister *reg, GncPluginPageRegister *page)
|
||||||
{
|
{
|
||||||
GtkActionGroup *action_group;
|
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
|
|
||||||
action_group = gnc_plugin_page_get_action_group (GNC_PLUGIN_PAGE (page));
|
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
|
||||||
action = gtk_action_group_get_action (action_group,
|
"SplitTransactionAction");
|
||||||
"SplitTransactionAction");
|
|
||||||
/* set sensitivity of split button */
|
/* set sensitivity of split button */
|
||||||
gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
|
gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
|
||||||
|
|
||||||
@ -890,7 +885,6 @@ gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
|
|||||||
const gchar *group_name)
|
const gchar *group_name)
|
||||||
{
|
{
|
||||||
GncPluginPageRegisterPrivate *priv;
|
GncPluginPageRegisterPrivate *priv;
|
||||||
GtkActionGroup *action_group;
|
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *style_name;
|
gchar *style_name;
|
||||||
@ -899,7 +893,6 @@ gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
|
|||||||
|
|
||||||
ENTER(" ");
|
ENTER(" ");
|
||||||
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
|
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
|
||||||
action_group = gnc_plugin_page_get_action_group(page);
|
|
||||||
|
|
||||||
/* Convert the style name to an index */
|
/* Convert the style name to an index */
|
||||||
style_name = g_key_file_get_string(key_file, group_name,
|
style_name = g_key_file_get_string(key_file, group_name,
|
||||||
@ -915,9 +908,7 @@ gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
|
|||||||
/* Update the style menu action for this page */
|
/* Update the style menu action for this page */
|
||||||
if (i <= REG_STYLE_JOURNAL) {
|
if (i <= REG_STYLE_JOURNAL) {
|
||||||
DEBUG("Setting style: %d", i);
|
DEBUG("Setting style: %d", i);
|
||||||
action_group =
|
action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
|
||||||
gnc_plugin_page_get_action_group(page);
|
|
||||||
action = gtk_action_group_get_action(action_group, radio_entries_2[i].name);
|
|
||||||
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
|
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,8 +916,7 @@ gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
|
|||||||
use_double_line =
|
use_double_line =
|
||||||
g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
|
g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
|
||||||
DEBUG("Setting double_line_mode: %d", use_double_line);
|
DEBUG("Setting double_line_mode: %d", use_double_line);
|
||||||
action = gtk_action_group_get_action(action_group,
|
action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
|
||||||
"ViewStyleDoubleLineAction");
|
|
||||||
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
|
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
|
||||||
|
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
#include "gtk-compat.h"
|
||||||
#ifndef HAVE_GLIB26
|
#ifndef HAVE_GLIB26
|
||||||
#include "gkeyfile.h"
|
#include "gkeyfile.h"
|
||||||
#endif
|
#endif
|
||||||
@ -992,29 +993,21 @@ close_handler (gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
gnc_plugin_page_report_set_fwd_button(GncPluginPageReport *report, int enabled)
|
gnc_plugin_page_report_set_fwd_button(GncPluginPageReport *report, int enabled)
|
||||||
{
|
{
|
||||||
GtkActionGroup *action_group;
|
|
||||||
GValue value = { 0 };
|
|
||||||
GtkAction *act;
|
GtkAction *act;
|
||||||
|
|
||||||
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(report));
|
act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
|
||||||
act = gtk_action_group_get_action( action_group, "ReportForwAction" );
|
"ReportForwAction" );
|
||||||
g_value_init (&value, G_TYPE_BOOLEAN);
|
gtk_action_set_sensitive(act, enabled);
|
||||||
g_value_set_boolean (&value, enabled);
|
|
||||||
g_object_set_property( G_OBJECT(act), "sensitive", &value );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_plugin_page_report_set_back_button(GncPluginPageReport *report, int enabled)
|
gnc_plugin_page_report_set_back_button(GncPluginPageReport *report, int enabled)
|
||||||
{
|
{
|
||||||
GtkActionGroup *action_group;
|
|
||||||
GValue value = { 0 };
|
|
||||||
GtkAction *act;
|
GtkAction *act;
|
||||||
|
|
||||||
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(report));
|
act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
|
||||||
act = gtk_action_group_get_action( action_group, "ReportBackAction" );
|
"ReportBackAction" );
|
||||||
g_value_init (&value, G_TYPE_BOOLEAN);
|
gtk_action_set_sensitive(act, enabled);
|
||||||
g_value_set_boolean (&value, enabled);
|
|
||||||
g_object_set_property( G_OBJECT(act), "sensitive", &value );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user