mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Update buttons on Multicolumn report options
Change the sensitivity of the multicolumn report options based on the selection in the two tree views using the select callback.
This commit is contained in:
parent
847766fc13
commit
5ff8d8daba
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.4 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<requires lib="gtk+" version="3.10"/>
|
||||||
<object class="GtkAdjustment" id="col_adjustment">
|
<object class="GtkAdjustment" id="col_adjustment">
|
||||||
@ -95,9 +95,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button85">
|
<object class="GtkButton" id="add_button1">
|
||||||
<property name="label" translatable="yes">A_dd >></property>
|
<property name="label" translatable="yes">A_dd >></property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
@ -110,9 +111,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button86">
|
<object class="GtkButton" id="remove_button1">
|
||||||
<property name="label" translatable="yes"><< _Remove</property>
|
<property name="label" translatable="yes"><< _Remove</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
@ -137,9 +139,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button87">
|
<object class="GtkButton" id="up_button1">
|
||||||
<property name="label" translatable="yes">Move _up</property>
|
<property name="label" translatable="yes">Move _up</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
@ -152,9 +155,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button88">
|
<object class="GtkButton" id="down_button1">
|
||||||
<property name="label" translatable="yes">Move dow_n</property>
|
<property name="label" translatable="yes">Move dow_n</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
@ -179,9 +183,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button89">
|
<object class="GtkButton" id="size_button1">
|
||||||
<property name="label" translatable="yes">Si_ze...</property>
|
<property name="label" translatable="yes">Si_ze...</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
@ -241,9 +246,11 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="titlebar">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="html_style_sheet_dialog">
|
<object class="GtkDialog" id="html_style_sheet_dialog">
|
||||||
<property name="visible">False</property>
|
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="title" translatable="yes">HTML Style Sheets</property>
|
<property name="title" translatable="yes">HTML Style Sheets</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
@ -416,6 +423,9 @@
|
|||||||
<action-widgets>
|
<action-widgets>
|
||||||
<action-widget response="-7">closebutton1</action-widget>
|
<action-widget response="-7">closebutton1</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAdjustment" id="row_adjustment">
|
<object class="GtkAdjustment" id="row_adjustment">
|
||||||
<property name="upper">100</property>
|
<property name="upper">100</property>
|
||||||
@ -573,6 +583,9 @@
|
|||||||
<action-widget response="-6">cancelbutton</action-widget>
|
<action-widget response="-6">cancelbutton</action-widget>
|
||||||
<action-widget response="-5">okbutton</action-widget>
|
<action-widget response="-5">okbutton</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="select_style_sheet_dialog">
|
<object class="GtkDialog" id="select_style_sheet_dialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@ -690,6 +703,9 @@
|
|||||||
<action-widget response="2">delete_button</action-widget>
|
<action-widget response="2">delete_button</action-widget>
|
||||||
<action-widget response="-7">close_button</action-widget>
|
<action-widget response="-7">close_button</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="template_liststore">
|
<object class="GtkListStore" id="template_liststore">
|
||||||
<columns>
|
<columns>
|
||||||
@ -849,5 +865,8 @@
|
|||||||
<action-widget response="-6">cancelbutton1</action-widget>
|
<action-widget response="-6">cancelbutton1</action-widget>
|
||||||
<action-widget response="-5">okbutton1</action-widget>
|
<action-widget response="-5">okbutton1</action-widget>
|
||||||
</action-widgets>
|
</action-widgets>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -67,6 +67,12 @@ struct gncp_column_view_edit
|
|||||||
SCM available_list;
|
SCM available_list;
|
||||||
SCM contents_list;
|
SCM contents_list;
|
||||||
int contents_selected;
|
int contents_selected;
|
||||||
|
|
||||||
|
GtkWidget *add_button;
|
||||||
|
GtkWidget *remove_button;
|
||||||
|
GtkWidget *up_button;
|
||||||
|
GtkWidget *down_button;
|
||||||
|
GtkWidget *size_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
void gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data);
|
void gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data);
|
||||||
@ -227,6 +233,50 @@ update_contents_lists(gnc_column_view_edit * view)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_column_view_update_buttons_cb (GtkTreeSelection *selection,
|
||||||
|
gnc_column_view_edit *r)
|
||||||
|
{
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeSelection *available_selection;
|
||||||
|
|
||||||
|
/* compare selection to establish which treeview selected */
|
||||||
|
available_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(r->available));
|
||||||
|
|
||||||
|
/* available treeview */
|
||||||
|
if (available_selection == selection)
|
||||||
|
{
|
||||||
|
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||||
|
gtk_widget_set_sensitive (r->add_button, TRUE);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (r->add_button, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* contents treeview */
|
||||||
|
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||||
|
{
|
||||||
|
int len = scm_ilength (r->contents_list);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (r->size_button, TRUE);
|
||||||
|
gtk_widget_set_sensitive (r->remove_button, TRUE);
|
||||||
|
|
||||||
|
if (len > 1)
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive (r->up_button, TRUE);
|
||||||
|
gtk_widget_set_sensitive (r->down_button, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_set_sensitive (r->up_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (r->down_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (r->size_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (r->remove_button, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_column_view_edit_apply_cb(GNCOptionWin * w, gpointer user_data)
|
gnc_column_view_edit_apply_cb(GNCOptionWin * w, gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -278,6 +328,7 @@ gnc_column_view_edit_options(SCM options, SCM view)
|
|||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
GtkTreeViewColumn *column;
|
||||||
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
ptr = scm_call_1(get_editor, view);
|
ptr = scm_call_1(get_editor, view);
|
||||||
if (ptr != SCM_BOOL_F)
|
if (ptr != SCM_BOOL_F)
|
||||||
@ -304,6 +355,13 @@ gnc_column_view_edit_options(SCM options, SCM view)
|
|||||||
editor = GTK_WIDGET(gtk_builder_get_object (builder, "view_contents_table"));
|
editor = GTK_WIDGET(gtk_builder_get_object (builder, "view_contents_table"));
|
||||||
r->available = GTK_TREE_VIEW (gtk_builder_get_object (builder, "available_view"));
|
r->available = GTK_TREE_VIEW (gtk_builder_get_object (builder, "available_view"));
|
||||||
r->contents = GTK_TREE_VIEW (gtk_builder_get_object (builder, "contents_view"));
|
r->contents = GTK_TREE_VIEW (gtk_builder_get_object (builder, "contents_view"));
|
||||||
|
|
||||||
|
r->add_button = GTK_WIDGET(gtk_builder_get_object (builder, "add_button1"));
|
||||||
|
r->remove_button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button1"));
|
||||||
|
r->up_button = GTK_WIDGET(gtk_builder_get_object (builder, "up_button1"));
|
||||||
|
r->down_button = GTK_WIDGET(gtk_builder_get_object (builder, "down_button1"));
|
||||||
|
r->size_button = GTK_WIDGET(gtk_builder_get_object (builder, "size_button1"));
|
||||||
|
|
||||||
r->options = options;
|
r->options = options;
|
||||||
r->view = view;
|
r->view = view;
|
||||||
r->available_list = SCM_EOL;
|
r->available_list = SCM_EOL;
|
||||||
@ -335,6 +393,11 @@ gnc_column_view_edit_options(SCM options, SCM view)
|
|||||||
NULL);
|
NULL);
|
||||||
gtk_tree_view_append_column(r->available, column);
|
gtk_tree_view_append_column(r->available, column);
|
||||||
|
|
||||||
|
/* use the selection cb to update buttons */
|
||||||
|
selection = gtk_tree_view_get_selection(r->available);
|
||||||
|
g_signal_connect(selection, "changed",
|
||||||
|
G_CALLBACK(gnc_column_view_update_buttons_cb), r);
|
||||||
|
|
||||||
/* Build the 'contents' view */
|
/* Build the 'contents' view */
|
||||||
store = gtk_list_store_new (NUM_CONTENTS_COLS, G_TYPE_STRING, G_TYPE_INT,
|
store = gtk_list_store_new (NUM_CONTENTS_COLS, G_TYPE_STRING, G_TYPE_INT,
|
||||||
G_TYPE_INT, G_TYPE_INT);
|
G_TYPE_INT, G_TYPE_INT);
|
||||||
@ -359,6 +422,11 @@ gnc_column_view_edit_options(SCM options, SCM view)
|
|||||||
NULL);
|
NULL);
|
||||||
gtk_tree_view_append_column(r->contents, column);
|
gtk_tree_view_append_column(r->contents, column);
|
||||||
|
|
||||||
|
/* use the selection cb to update buttons */
|
||||||
|
selection = gtk_tree_view_get_selection(r->contents);
|
||||||
|
g_signal_connect(selection, "changed",
|
||||||
|
G_CALLBACK(gnc_column_view_update_buttons_cb), r);
|
||||||
|
|
||||||
update_available_lists(r);
|
update_available_lists(r);
|
||||||
update_contents_lists(r);
|
update_contents_lists(r);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user