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:
David Hampton 2006-02-24 04:50:03 +00:00
parent e706e3f023
commit fa8cae90e1
9 changed files with 54 additions and 37 deletions

View File

@ -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>
* gentoo/gnucash-1.9.x.ebuild: Add ebuild for gnucash 1.9/2.0 series.

View File

@ -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))
return;
g_object_set(widget, "sensitive", !cw->is_currency, NULL);
gtk_widget_set_sensitive(widget, !cw->is_currency);
}
static void

View File

@ -2501,7 +2501,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
action = gtk_action_group_get_action(priv->action_group,
"ExtensionsAction");
g_object_set(G_OBJECT(action), "visible", FALSE, (char *)NULL);
gtk_action_set_visible(action, FALSE);
}
/* GncPluginManager stuff */

View File

@ -34,6 +34,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include "gtk-compat.h"
#include <string.h>
#include "gnc-file.h"
@ -316,7 +317,7 @@ gnc_history_update_action (GncMainWindow *window,
g_free(old_filename);
g_object_set_data(G_OBJECT(action), FILENAME_STRING, g_strdup(filename));
} else {
g_object_set(G_OBJECT(action), "visible", FALSE, NULL);
gtk_action_set_visible(action, FALSE);
}
g_free(action_name);
LEAVE("");

View File

@ -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. */
const gchar *
gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page)

View File

@ -451,6 +451,15 @@ GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
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 */
void gnc_plugin_page_inserted (GncPluginPage *plugin_page);

View File

@ -393,8 +393,7 @@ static void addRecurrence(GncRecurrenceComp *grc, GncRecurrence *gr)
G_CALLBACK(grc_changed), grc );
grc->num_rec++;
g_object_set(G_OBJECT(grc->buttRemove), "sensitive",
(grc->num_rec > 1), NULL);
gtk_widget_set_sensitive(GTK_WIDGET(grc->buttRemove), (grc->num_rec > 1));
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_object_set(G_OBJECT(grc->buttRemove), "sensitive",
(grc->num_rec > 1), NULL);
gtk_widget_set_sensitive(GTK_WIDGET(grc->buttRemove), (grc->num_rec > 1));
}

View File

@ -588,14 +588,11 @@ gnc_plugin_page_register_get_account (GncPluginPageRegister *page)
static void
gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageRegister *page)
{
GtkActionGroup *action_group;
GtkAction *action;
gboolean expanded;
expanded = gnc_split_register_current_trans_expanded(reg);
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(page));
action = gtk_action_group_get_action (action_group,
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
"SplitTransactionAction");
g_signal_handlers_block_by_func
@ -608,11 +605,9 @@ gnc_plugin_page_register_update_split_button (SplitRegister *reg, GncPluginPageR
static void
gnc_plugin_page_register_update_toolbar (SplitRegister *reg, GncPluginPageRegister *page)
{
GtkActionGroup *action_group;
GtkAction *action;
action_group = gnc_plugin_page_get_action_group (GNC_PLUGIN_PAGE (page));
action = gtk_action_group_get_action (action_group,
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
"SplitTransactionAction");
/* set sensitivity of split button */
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)
{
GncPluginPageRegisterPrivate *priv;
GtkActionGroup *action_group;
GtkAction *action;
GError *error = NULL;
gchar *style_name;
@ -899,7 +893,6 @@ gnc_plugin_page_register_restore_edit_menu (GncPluginPage *page,
ENTER(" ");
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
action_group = gnc_plugin_page_get_action_group(page);
/* Convert the style name to an index */
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 */
if (i <= REG_STYLE_JOURNAL) {
DEBUG("Setting style: %d", i);
action_group =
gnc_plugin_page_get_action_group(page);
action = gtk_action_group_get_action(action_group, radio_entries_2[i].name);
action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
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 =
g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
DEBUG("Setting double_line_mode: %d", use_double_line);
action = gtk_action_group_get_action(action_group,
"ViewStyleDoubleLineAction");
action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
LEAVE(" ");

View File

@ -41,6 +41,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "gtk-compat.h"
#ifndef HAVE_GLIB26
#include "gkeyfile.h"
#endif
@ -992,29 +993,21 @@ close_handler (gpointer user_data)
static void
gnc_plugin_page_report_set_fwd_button(GncPluginPageReport *report, int enabled)
{
GtkActionGroup *action_group;
GValue value = { 0 };
GtkAction *act;
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(report));
act = gtk_action_group_get_action( action_group, "ReportForwAction" );
g_value_init (&value, G_TYPE_BOOLEAN);
g_value_set_boolean (&value, enabled);
g_object_set_property( G_OBJECT(act), "sensitive", &value );
act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
"ReportForwAction" );
gtk_action_set_sensitive(act, enabled);
}
static void
gnc_plugin_page_report_set_back_button(GncPluginPageReport *report, int enabled)
{
GtkActionGroup *action_group;
GValue value = { 0 };
GtkAction *act;
action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(report));
act = gtk_action_group_get_action( action_group, "ReportBackAction" );
g_value_init (&value, G_TYPE_BOOLEAN);
g_value_set_boolean (&value, enabled);
g_object_set_property( G_OBJECT(act), "sensitive", &value );
act = gnc_plugin_page_get_action(GNC_PLUGIN_PAGE(report),
"ReportBackAction" );
gtk_action_set_sensitive(act, enabled);
}
// ------------------------------------------------------------