mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Bob Fewell's 'gnc-edit-changes' into master.
This commit is contained in:
commit
608e700a24
@ -641,7 +641,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
|
|||||||
*cursor_position += change_chars;
|
*cursor_position += change_chars;
|
||||||
box_str = match_str;
|
box_str = match_str;
|
||||||
}
|
}
|
||||||
else
|
else if (cell->shared_store)
|
||||||
{
|
{
|
||||||
// No start-of-name match, try type-ahead search, we match any substring of the full account name.
|
// No start-of-name match, try type-ahead search, we match any substring of the full account name.
|
||||||
GtkListStore *store = cell->shared_store;
|
GtkListStore *store = cell->shared_store;
|
||||||
@ -655,7 +655,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
|
|||||||
|
|
||||||
if (match_str == NULL)
|
if (match_str == NULL)
|
||||||
{
|
{
|
||||||
if (gnc_item_list_using_temp (box->item_list))
|
if (cell->shared_store && gnc_item_list_using_temp (box->item_list))
|
||||||
{
|
{
|
||||||
block_list_signals (cell); //Prevent recursion
|
block_list_signals (cell); //Prevent recursion
|
||||||
gnc_item_list_set_temp_store (box->item_list, NULL);
|
gnc_item_list_set_temp_store (box->item_list, NULL);
|
||||||
@ -666,6 +666,8 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
|
|||||||
block_list_signals (cell);
|
block_list_signals (cell);
|
||||||
gnc_item_list_select (box->item_list, NULL);
|
gnc_item_list_select (box->item_list, NULL);
|
||||||
unblock_list_signals (cell);
|
unblock_list_signals (cell);
|
||||||
|
*cursor_position = *start_selection = newval_chars;
|
||||||
|
*end_selection = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +904,8 @@ popup_get_height (G_GNUC_UNUSED GtkWidget* widget,
|
|||||||
int count, height;
|
int count, height;
|
||||||
|
|
||||||
count = gnc_item_list_num_entries (box->item_list);
|
count = gnc_item_list_num_entries (box->item_list);
|
||||||
height = count * row_height;
|
height = count * (gnc_item_list_get_cell_height (box->item_list) + 2);
|
||||||
|
|
||||||
if (height < space_available)
|
if (height < space_available)
|
||||||
{
|
{
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
|
||||||
@ -980,9 +983,13 @@ gnc_combo_cell_enter (BasicCell* bcell,
|
|||||||
popup_get_width, box);
|
popup_get_width, box);
|
||||||
|
|
||||||
block_list_signals (cell);
|
block_list_signals (cell);
|
||||||
// Clear the temp store to ensure we don't start in type-ahead mode.
|
|
||||||
gnc_item_list_set_temp_store (box->item_list, NULL);
|
if (cell->shared_store && gnc_item_list_using_temp (box->item_list))
|
||||||
gtk_list_store_clear (box->tmp_store);
|
{
|
||||||
|
// Clear the temp store to ensure we don't start in type-ahead mode.
|
||||||
|
gnc_item_list_set_temp_store (box->item_list, NULL);
|
||||||
|
gtk_list_store_clear (box->tmp_store);
|
||||||
|
}
|
||||||
gnc_item_list_select (box->item_list, bcell->value);
|
gnc_item_list_select (box->item_list, bcell->value);
|
||||||
unblock_list_signals (cell);
|
unblock_list_signals (cell);
|
||||||
|
|
||||||
|
@ -125,6 +125,8 @@ gnc_date_picker_class_init (GNCDatePickerClass *date_picker_class)
|
|||||||
|
|
||||||
object_class = G_OBJECT_CLASS (date_picker_class);
|
object_class = G_OBJECT_CLASS (date_picker_class);
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(date_picker_class), "gnc-id-date-picker");
|
||||||
|
|
||||||
gnc_date_picker_signals[DATE_SELECTED] =
|
gnc_date_picker_signals[DATE_SELECTED] =
|
||||||
g_signal_new("date_selected",
|
g_signal_new("date_selected",
|
||||||
G_TYPE_FROM_CLASS(object_class),
|
G_TYPE_FROM_CLASS(object_class),
|
||||||
|
@ -61,7 +61,7 @@ enum
|
|||||||
static GtkBoxClass *gnc_item_edit_parent_class;
|
static GtkBoxClass *gnc_item_edit_parent_class;
|
||||||
|
|
||||||
static GtkToggleButtonClass *gnc_item_edit_tb_parent_class;
|
static GtkToggleButtonClass *gnc_item_edit_tb_parent_class;
|
||||||
static void gnc_item_edit_destroying(GtkWidget *this, gpointer data);
|
static void gnc_item_edit_destroying (GtkWidget *this, gpointer data);
|
||||||
static void
|
static void
|
||||||
gnc_item_edit_tb_init (GncItemEditTb *item_edit_tb)
|
gnc_item_edit_tb_init (GncItemEditTb *item_edit_tb)
|
||||||
{
|
{
|
||||||
@ -848,7 +848,6 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
|||||||
GtkBorder padding;
|
GtkBorder padding;
|
||||||
GtkBorder margin;
|
GtkBorder margin;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
GtkWidget *vb = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
||||||
GncItemEdit *item_edit =
|
GncItemEdit *item_edit =
|
||||||
g_object_new (GNC_TYPE_ITEM_EDIT,
|
g_object_new (GNC_TYPE_ITEM_EDIT,
|
||||||
"sheet", sheet,
|
"sheet", sheet,
|
||||||
@ -904,12 +903,7 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
|||||||
gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.ebox),
|
gtk_container_add(GTK_CONTAINER(item_edit->popup_toggle.ebox),
|
||||||
item_edit->popup_toggle.tbutton);
|
item_edit->popup_toggle.tbutton);
|
||||||
|
|
||||||
/* The button needs to be packed into a vertical box so that the height and position
|
gtk_box_pack_start (GTK_BOX(item_edit), item_edit->popup_toggle.ebox, FALSE, FALSE, 0);
|
||||||
* can be controlled in earlier than Gtk3.20 versions */
|
|
||||||
gtk_box_pack_start (GTK_BOX(vb), item_edit->popup_toggle.ebox,
|
|
||||||
FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX(item_edit), vb, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show_all(GTK_WIDGET(item_edit));
|
gtk_widget_show_all(GTK_WIDGET(item_edit));
|
||||||
g_signal_connect(G_OBJECT(item_edit), "destroy",
|
g_signal_connect(G_OBJECT(item_edit), "destroy",
|
||||||
G_CALLBACK(gnc_item_edit_destroying), NULL);
|
G_CALLBACK(gnc_item_edit_destroying), NULL);
|
||||||
@ -917,10 +911,12 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_item_edit_destroying(GtkWidget *item_edit, gpointer data)
|
gnc_item_edit_destroying (GtkWidget *item_edit, gpointer data)
|
||||||
{
|
{
|
||||||
g_signal_handler_disconnect (GNC_ITEM_EDIT (item_edit)->popup_item,
|
if (GNC_ITEM_EDIT (item_edit)->popup_height_signal_id > 0)
|
||||||
GNC_ITEM_EDIT (item_edit)->popup_height_signal_id);
|
g_signal_handler_disconnect (GNC_ITEM_EDIT (item_edit)->popup_item,
|
||||||
|
GNC_ITEM_EDIT (item_edit)->popup_height_signal_id);
|
||||||
|
|
||||||
while (g_idle_remove_by_data((gpointer)item_edit))
|
while (g_idle_remove_by_data((gpointer)item_edit))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1012,13 +1008,11 @@ gnc_item_edit_show_popup (GncItemEdit *item_edit)
|
|||||||
|
|
||||||
// Lets check popup height is the true height
|
// Lets check popup height is the true height
|
||||||
item_edit->popup_returned_height = popup_h;
|
item_edit->popup_returned_height = popup_h;
|
||||||
if (!item_edit->popup_height_signal_id)
|
|
||||||
item_edit->popup_height_signal_id =
|
|
||||||
g_signal_connect_after (item_edit->popup_item, "size-allocate",
|
|
||||||
G_CALLBACK(check_popup_height_is_true),
|
|
||||||
item_edit);
|
|
||||||
|
|
||||||
gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
|
if (popup_h == popup_max_height)
|
||||||
|
gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
|
||||||
|
else
|
||||||
|
gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, -1);
|
||||||
|
|
||||||
toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
|
toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
|
||||||
|
|
||||||
@ -1087,6 +1081,7 @@ gnc_item_edit_hide_popup (GncItemEdit *item_edit)
|
|||||||
gtk_widget_grab_focus (GTK_WIDGET (item_edit->sheet));
|
gtk_widget_grab_focus (GTK_WIDGET (item_edit->sheet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_item_edit_set_popup (GncItemEdit *item_edit,
|
gnc_item_edit_set_popup (GncItemEdit *item_edit,
|
||||||
GtkWidget *popup_item,
|
GtkWidget *popup_item,
|
||||||
@ -1102,6 +1097,24 @@ gnc_item_edit_set_popup (GncItemEdit *item_edit,
|
|||||||
if (item_edit->is_popup)
|
if (item_edit->is_popup)
|
||||||
gnc_item_edit_hide_popup (item_edit);
|
gnc_item_edit_hide_popup (item_edit);
|
||||||
|
|
||||||
|
/* setup size-allocate callback for popup_item height, done here as
|
||||||
|
item_edit is constant and popup_item changes per cell */
|
||||||
|
if (popup_item)
|
||||||
|
{
|
||||||
|
item_edit->popup_height_signal_id = g_signal_connect_after (
|
||||||
|
popup_item, "size-allocate",
|
||||||
|
G_CALLBACK(check_popup_height_is_true),
|
||||||
|
item_edit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GNC_ITEM_EDIT (item_edit)->popup_height_signal_id > 0)
|
||||||
|
{
|
||||||
|
g_signal_handler_disconnect (item_edit->popup_item, item_edit->popup_height_signal_id);
|
||||||
|
item_edit->popup_height_signal_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
item_edit->is_popup = popup_item != NULL;
|
item_edit->is_popup = popup_item != NULL;
|
||||||
|
|
||||||
item_edit->popup_item = popup_item;
|
item_edit->popup_item = popup_item;
|
||||||
|
@ -283,6 +283,7 @@ gnc_item_list_init (GncItemList* item_list)
|
|||||||
item_list->tree_view = NULL;
|
item_list->tree_view = NULL;
|
||||||
item_list->list_store = NULL;
|
item_list->list_store = NULL;
|
||||||
item_list->temp_store = NULL;
|
item_list->temp_store = NULL;
|
||||||
|
item_list->cell_height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -385,6 +386,7 @@ gnc_item_list_class_init (GncItemListClass* item_list_class)
|
|||||||
|
|
||||||
gnc_item_list_parent_class = g_type_class_peek_parent (item_list_class);
|
gnc_item_list_parent_class = g_type_class_peek_parent (item_list_class);
|
||||||
|
|
||||||
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(item_list_class), "gnc-id-sheet-list");
|
||||||
|
|
||||||
gnc_item_list_signals[SELECT_ITEM] =
|
gnc_item_list_signals[SELECT_ITEM] =
|
||||||
g_signal_new ("select_item",
|
g_signal_new ("select_item",
|
||||||
@ -474,11 +476,25 @@ tree_view_selection_changed (GtkTreeSelection* selection,
|
|||||||
g_free (string);
|
g_free (string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gint
|
||||||
|
gnc_item_list_get_cell_height (GncItemList *item_list)
|
||||||
|
{
|
||||||
|
|
||||||
|
gint min_height, nat_height;
|
||||||
|
gtk_cell_renderer_get_preferred_height (item_list->renderer,
|
||||||
|
GTK_WIDGET(item_list->tree_view),
|
||||||
|
&min_height,
|
||||||
|
&nat_height);
|
||||||
|
|
||||||
|
return min_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gnc_item_list_new (GtkListStore* list_store)
|
gnc_item_list_new (GtkListStore* list_store)
|
||||||
{
|
{
|
||||||
GtkWidget* tree_view;
|
GtkWidget* tree_view;
|
||||||
GtkCellRenderer* renderer;
|
|
||||||
GtkTreeViewColumn* column;
|
GtkTreeViewColumn* column;
|
||||||
|
|
||||||
GncItemList* item_list =
|
GncItemList* item_list =
|
||||||
@ -508,9 +524,9 @@ gnc_item_list_new (GtkListStore* list_store)
|
|||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
||||||
0, GTK_SORT_ASCENDING);
|
0, GTK_SORT_ASCENDING);
|
||||||
|
|
||||||
renderer = gtk_cell_renderer_text_new();
|
item_list->renderer = gtk_cell_renderer_text_new();
|
||||||
column = gtk_tree_view_column_new_with_attributes (_ ("List"),
|
column = gtk_tree_view_column_new_with_attributes (_ ("List"),
|
||||||
renderer,
|
item_list->renderer,
|
||||||
"text", 0,
|
"text", 0,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
|
||||||
@ -526,11 +542,9 @@ gnc_item_list_new (GtkListStore* list_store)
|
|||||||
g_signal_connect (G_OBJECT (tree_view), "key_press_event",
|
g_signal_connect (G_OBJECT (tree_view), "key_press_event",
|
||||||
G_CALLBACK (gnc_item_list_key_event), item_list);
|
G_CALLBACK (gnc_item_list_key_event), item_list);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (
|
g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (
|
||||||
tree_view))), "changed",
|
GTK_TREE_VIEW (tree_view))), "changed",
|
||||||
G_CALLBACK (tree_view_selection_changed), item_list);
|
G_CALLBACK (tree_view_selection_changed), item_list);
|
||||||
|
|
||||||
return GTK_WIDGET (item_list);
|
return GTK_WIDGET (item_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ typedef struct
|
|||||||
GtkScrolledWindow* scrollwin;
|
GtkScrolledWindow* scrollwin;
|
||||||
GtkListStore *list_store; /* Contains the list items */
|
GtkListStore *list_store; /* Contains the list items */
|
||||||
GtkListStore *temp_store; /* Temporary store for typeahead select */
|
GtkListStore *temp_store; /* Temporary store for typeahead select */
|
||||||
|
GtkCellRenderer *renderer;
|
||||||
|
gint cell_height;
|
||||||
} GncItemList;
|
} GncItemList;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -69,6 +71,8 @@ GtkWidget *gnc_item_list_new (GtkListStore *shared_store);
|
|||||||
|
|
||||||
gint gnc_item_list_num_entries (GncItemList *item_list);
|
gint gnc_item_list_num_entries (GncItemList *item_list);
|
||||||
|
|
||||||
|
gint gnc_item_list_get_cell_height (GncItemList *item_list);
|
||||||
|
|
||||||
void gnc_item_list_clear (GncItemList *item_list);
|
void gnc_item_list_clear (GncItemList *item_list);
|
||||||
|
|
||||||
void gnc_item_list_append (GncItemList *item_list, const char *string);
|
void gnc_item_list_append (GncItemList *item_list, const char *string);
|
||||||
|
@ -391,7 +391,6 @@ gnucash/register/register-gnome/gnucash-header.c
|
|||||||
gnucash/register/register-gnome/gnucash-item-edit.c
|
gnucash/register/register-gnome/gnucash-item-edit.c
|
||||||
gnucash/register/register-gnome/gnucash-item-list.c
|
gnucash/register/register-gnome/gnucash-item-list.c
|
||||||
gnucash/register/register-gnome/gnucash-register.c
|
gnucash/register/register-gnome/gnucash-register.c
|
||||||
gnucash/register/register-gnome/gnucash-scrolled-window.c
|
|
||||||
gnucash/register/register-gnome/gnucash-sheet.c
|
gnucash/register/register-gnome/gnucash-sheet.c
|
||||||
gnucash/register/register-gnome/gnucash-sheet-private.c
|
gnucash/register/register-gnome/gnucash-sheet-private.c
|
||||||
gnucash/register/register-gnome/gnucash-style.c
|
gnucash/register/register-gnome/gnucash-style.c
|
||||||
|
Loading…
Reference in New Issue
Block a user