1.21.6: 2012-03-05 Murray Cumming Utils::get_find_where_clause_quick(): Handle an empty value properly. * glom/libglom/utils.cc: get_find_where_clause_quick(): Handle an empty quick_search value properly, returning an empty where clause. 2012-03-03 Ben Konrath Remove empty group in the Lesson Planner example file. The empty group was at the bottome of the Rooms table details view. https://bugzilla.gnome.org/show_bug.cgi?id=671263 * examples/example_lesson_planner.glom: 2012-03-03 Murray Cumming Remove remaining uses of deprecated Gtk::Main API. 2012-03-01 Murray Cumming Add a unistd.h include to fix the mingw MS Windows build. * glom/glom_create_from_example.cc: include unistd.h for getpass(). Bug #671120 (alien) 2012-03-01 Murray Cumming Make auto-increment fields work even if they are not primary keys. * glom/libglom/db_utils.h: get_next_auto_increment_value(): Document that this also increments the value ready for the next call. * glom/base_db_table_data.cc: record_new(): Decide auto-increment values as well as just default values and calculated values. And do this while building the SQL, instead of first setting it in the widget, because we do not always want to use the entered data, so we would then ignore those automatic values accidentally. Bug #661702 2012-03-01 Murray Cumming Make the --debug_sql option work again. * glom/appwindow.cc: set_show_sql_debug(): Set it in the ConnectionPool too. This was broken since the change to Gtk::Application. 2012-03-01 Murray Cumming ConnectionPool::change_columns(): Add/Remove autoincement rows here. * glom/libglom/connectionpool.cc: change_columns(): Add or remove the auto-increment row from the database preferences table. This would be added automatically anyway but this makes sure that it is there for editing as soon as the field is added, and makes sure that it is removed. * tests/test_selfhosting_new_then_change_columns.cc: Try setting a field as auto-increment. 2012-03-01 Murray Cumming Tests: Update the expected number of locales. * tests/test_document_load_translations.cc: There are now 7 locales in the example document. 2012-03-01 Murray Cumming More windows build fixes. * glom/libglom/connectionpool_backends/postgres.cc: Add an include and change the ifdefed code slightly to fix the mingw build on Windows. Bug #670903 (alien) 2012-03-01 Murray Cumming Add a fcntl.h include. * glom/libglom/utils.cc: Include fcntl.h to fix the mingw build on Windows. Bug #670903 (alien) 2012-02-29 Murray Cumming Use Gtk::ApplicationWindow. * glom/bakery/appwindow_withdoc_gtk.[h|cc]: Use Gtk::ApplicationWindow instead of Gtk::Window. 2012-02-15 Murray Cumming Remove now-unnecessary call to init_gtkmm. * glom/application.cc: The latest gtkmm code in git master makes this unnecessary. 2012-02-13 Murray Cumming Application: Do not load documents twice. * glom/application.cc: on_open(): Correct the call to the base class method, to avoid a second attempt to open the same document. 2012-02-10 Murray Cumming Remove use of Gtk::Main functions. * glom/bakery/busy_cursor.cc: * glom/import_csv/dialog_import_csv_progress.cc: Use the C API for events_pending/iteration to avoid a crash. 2012-02-10 Murray Cumming AppWindow: Rename get_application() to get_appwindow(). 2012-02-10 Murray Cumming Do not use Gtk::Main. * glom/application.cc: create(): Call the new init_gtkmm method. * glom/main.cc: Remove the use of Gtk::Main because it is no unnecessary. 2012-02-10 Murray Cumming --debug-date-check: Do not show the window. * glom/main_local_options.[h|cc]: Make the handler function a class method, and make the variables private. Add a get_debug_date_check_result() method. * glom/application.cc: Stop the application, before showing the window, if the --debug-date-check option was given, as before we used GApplication. 2012-02-10 Murray Cumming > Move all command-line handling into the remote Application. * glom/main.cc: * glom/application.cc: * glom/main_local_options.[h|cc]: * glom/main_remote_options.[h|cc]: Split the command-line options into two OptionGroups, in their own files, even putting local option handling in its separate file. This lets us handle them properly, despite the lack of GApplication support for separate local/remote GOption handling. ( See https://bugzilla.gnome.org/show_bug.cgi?id=634990#c6 ) thanks to our use of G_APPLICATION_NON_UNIQUE. Having them separate should make it easier to really do it properly if GApplication ever allows it. 2012-02-10 Murray Cumming Use G_APPLICATION_NON_UNIQUE. * glom/application.cc: This is necessary because we use singletons that are really per-AppWindow, to simplify our code. 2012-02-10 Murray Cumming Add a Gtk::Application subclass, used by main(). * Makefile.am: * main.cc: * glom/application.[h|cc]: Use a derived Gtk::Application which instantiates the Glom::AppWindow via its on_open(). Some command-line option handling is temporarily commented out. 2012-02-24 Murray Cumming Fix a typo in the previous commit. * glom/mode_data/box_data_list_related.cc: Do not use m_found_set where we really mean found_set. 2012-02-24 Murray Cumming Prevent SQL SELECT errors when the user does not have view (SELECT) rights. * glom/libglom/privs.cc: get_current_privs(): Check for an empty table name to avoid SQL errors. * glom/frame_glom.cc: show_table_allow_empty(): * glom/mode_data/box_data_list.cc: fill_from_database(), create_layout(), * glom/mode_data/box_data_list_related.cc: init_db_detail(), create_layout(): * glom/mode_data/datawidget/combochoiceswithtreemodel.cc: set_choices_related(): Set DbAddDel::set_allow_view(), with the discovered view privileges for the current user, to avoid SQL errors when the user does not have SELECT rights. 2012-02-24 Murray Cumming More not hiding the database structure if the user does not have view rights. * glom/mode_data/box_data_list_related.cc: Do not check if the field really exists, because that will fail if the user does not have view (SELECT) rights. 2012-02-23 Murray Cumming Do not hide the database structure if the user does not have view rights. * glom/frame_glom.cc: update_table_in_document_from_database(): Warn if we cannot get the fields list from the database and do not then assume that there are no fields. * glom/libglom/db_utils.cc: get_fields_for_table(): Do not get the fields from the database because it is inefficient and we should already have updated the document. * glom/mode_data/box_data_list.cc: create_layout(): Do not (incredibly inefficiently) check that each field exists in the database. We should already have updated the document. This should make the UI faster too. Bug #669299 2012-02-23 Murray Cumming Change lots of g_warnings() to std::cerr. 2012-02-23 Murray Cumming FieldTypes: Add defaults. * glom/libglom/data_structure/fieldtypes.[h|cc]: Fallback to a hard-coded map of database types to GType types, for the (so far unexplained) cases where CONNECTION_META_TYPES gives us no rows. 2012-02-22 Murray Cumming List View: Make print layouts grayed-out if no record is selected. * glom/mode_data/db_adddel/db_adddel.[h|cc]: Add signal_record_selection_changed and emit it when the TreeView's selection changes: * glom/mode_data/db_adddel/db_adddel_withbuttons.cc: Make sure that we call the base class. * glom/mode_data/box_data_manyrecords.[h|cc]: Added signal_record_selection_changed. * glom/mode_data/box_data_list.[h|cc]: Handle the AddDel_DB's signal_record_selection_changed, emitting our own signal_record_selection_changed. * glom/mode_data/notebook_data.[h|cc]: Handle the Box_Data_List's signal_record_selection_changed, emitting our own signal_record_selection_changed. I still do not like the repetition that is required here, and elsewhere, when a child widget needs to signal all the way up an ownership hierarchy. * glom/appwindow.[h|cc]: Add enable_menu_print_layouts_details(). * glom/frame_glom.[h|cc]: Handle the Notebook_Data's signal_record_selection_changed(), calling the AppWindow's enable_menu_print_layouts_details(). 2012-02-22 Murray Cumming Allow printing of print layouts from the list view. * glom/appwindow.cc: fill_menu_print_layouts(): Show the print layouts even if the list view is visible. * glom/mode_data/notebook_data.[h|cc]: get_found_set_details(): Replace with get_found_set_selected() which checks the selected record in the list view, if the list view is visible, instead of just the details view. * glom/frame_glom.[h|cc]: Remove get_viewing_details(). do_print_layout(): Use get_found_set_selected() so we can print the print layout for the selected record. This avoids some confusion caused by the print layouts not being available when viewing the list instead of the details. Bug #670462 (alien) 2012-02-13 Murray Cumming Users: Warn if we cannot get the list of users. * glom/libglom/privs.[h|cc]: get_database_users(): Add documentation about the case that the result is empty. * glom/mode_design/users/dialog_users_list.cc: on_button_user_add(): If the users list is empty then warn that something is probably wrong with the permissions. I would like to warn much earlier if the user is not a superuser, but I do not know how. Bug #669178 (alien) 2012-02-10 Murray Cumming AppWindow: Rename get_application() to get_appwindow(). 2012-02-09 Murray Cumming Rename Application to AppWindow. Rename Application to AppWindow and rename the Bakery::App* classes appropriately too. This is a preparation for using Gtk::Application. 2012-02-09 Murray Cumming Print Layout: Print Preview: Avoid warnings when there are no records yet. * glom/print_layout/canvas_print_layout.cc: fill_with_data(): Do nothing, and hint on stdout, if there are no records yet. This avoids several real warnings later. 2012-02-08 Murray Cumming Print Layout: Avoid sometimes over-scaled images. * glom/print_layout/canvas_layout_item.[h|cc]: Remove the constructor and create() that take a LayoutItem, because we should put the CanvasItem in a canvas (even indirectly) before creating the child item, to avoid this goocanvas bug: https://bugzilla.gnome.org/show_bug.cgi?id=657592#c16 * glom/mode_design/print_layouts/window_print_layout_edit.[h|cc]: * glom/print_layout/canvas_print_layout.[h|cc]: Add and use create_canvas_layout_item_and_add() methods which put the new canvas item in the canvas before creating its child items based on the LayoutItem. This fixes bug #668901 (alien) 2012-02-05 Murray Cumming Button scripts and Field Calculations: Test button: Check for pygtk2. * glom/mode_data/box_data.cc: :execute_button_script(): Move the warning UI into * glom/utils_ui.[h|cc]: a new script_check_for_pygtk2_with_warning() method. * glom/mode_design/fields/dialog_fieldcalculation.cc: on_button_test(): * glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc: on_button_test_script(): Use the new function here. 2012-02-03 Murray Cumming Button scripts: Check and warn about pygtk2 instead of crashing. * glom/libglom/utils.[h|cc]: Add script_check_for_pygtk(). * Makefile_tests.am: * tests/test_script_check_for_problems.cc: Add a test for the check function. * glom/mode_data/box_data.cc: execute_button_script(): Show a warning dialog, and do not run the script, if it seems to use pygtk. This should help with but #669196 (alien) and ##661766 (Andre Klapper) . 2012-02-03 Murray Cumming ReportBuilder: Add error checking. * glom/libglom/report_builder.[h|cc]: Return bool from the private methods and check those results. 2012-02-03 Murray Cumming Reports: Make summary fields work again. * glom/libglom/report_builder.cc: report_build_summary(): Remove any sort clause (ORDER BY) from the FoundSet because that makes no sense for a single row with summary fields. It looks like recent versions of PostgreSQL have become more strict about this, producing this error, for instance: column "invoices.invoice_id" must appear in the GROUP BY clause or be used in an aggregate function * Makefile_tests.am: * tests/test_selfhosting_new_then_report_summary.cc: Add a test for this. This fixes bug #669281 (alien) 2012-02-03 Murray Cumming Document: Really load the table privileges. * glom/libglom/db_utils.[h|cc]: add_group(): Take a bool superuser parameter. add_groups_from_document(): Use add_group() instead of executing the ADD GROUP query directly, to make sure that we also start with some sane table privileges defaults, in case nothing else sets the privielges. * glom/libglom/document/document.cc: load_after(): Fix a typo so that the group privileges are really loaded (and then saved again instead of being lost). * examples/example_film_manager.glom: * examples/example_smallbusiness.glom: Save these with useful group privileges, so the groups will be allowed to see tables. * tests/test_document_load.cc: Test the loading of the group privileges. Previously the examples were created with groups that could not even view the tables, which meant that they could not even find out about their existence. This deals with the problem found here: https://bugzilla.gnome.org/show_bug.cgi?id=669043#c2 But I would like to show the existence (and structure) of tables even if their data cannot be viewed, so there is more work to do. 2012-02-03 Murray Cumming test_selfhosting_new_empty_then_users: Slight improvement. * tests/test_selfhosting_new_from_example_operator.cc: Check that the group exists before adding a user to it. 2012-02-03 Murray Cumming Add some runtime warnings. * glom/libglom/db_utils.cc: get_table_names_from_database(): Slightly improved error checking. * glom/libglom/privs.cc: set_table_privileges(): Warn if a GRANT fails. 2012-02-02 Murray Cumming Share on Network: Add reassuring message when user removal fails. * glom/frame_glom.cc: Add a stdout message saying the the default user has been disabled, because the existing message about the failure to remove the user looks at first like a security problem. I still do not know why removal fails, even though we do change the ownership of the database. 2012-02-02 Murray Cumming test_selfhosting_new_empty_then_users: Test user removal. * glom/base_db.[h|cc]: Move remove_user() and remove_user_from_group() to * glom/libglom/db_utils.[h|cc]. * glom/frame_glom.cc: * glom/mode_design/users/dialog_users_list.cc: Adapted. * tests/test_selfhosting_new_empty_then_users.cc: Test these functions. 2012-02-02 Murray Cumming Really prevent changing to developer mode for non-developers. * glom/frame_glom.cc: on_menu_developer_developer(): Actually use the result of Privs::get_user_is_in_group(). * tests/test_selfhosting_new_from_example_operator.cc: Test this same function here, though this test currently fails anyway. This fixes bug #669043 (alien) 2012-02-01 Murray Cumming Allow user and group names to have spaces and other special characters. * glom/libglom/privs.cc: get_table_privileges(): Instead of parsing the relacl.pg_class field, use the PostgreSQL has_table_privilege() function, though it needs some strange quoting (see comments). This code is much simpler now. * tests/test_selfhosting_new_empty_then_users.cc: Add various other table, group, and user names, to excercise the code. This now passes. 2012-02-01 Murray Cumming Fix the build. * glom/mode_design/users/dialog_new_group.cc: * glom/mode_design/users/dialog_user.cc: Add includes to fix the build. 2012-02-01 Murray Cumming test_selfhosting_new_empty_then_users: Show the problem with spaces. * tests/test_selfhosting_new_empty_then_users.cc: Privs::get_table_privileges() must parse a strange format. This test shows that it fails if the group name contains spaces. 2012-02-01 Murray Cumming Limit user and group name lengths. * glom/libglom/privs.[h|cc]: Add a MAX_ROLE_SIZE enum constants. I cannot find any PostgreSQL documentation of this 63 character limit. * glom/mode_design/users/dialog_new_group.cc: * glom/mode_design/users/dialog_user.cc: Use it to set maximum characters for the entry boxes. * tests/test_selfhosting_new_empty_then_users.cc: Show that the problem found so far was caused by too-long names, not spaces. I still need to check parsing of table permissions. 2012-02-01 Murray Cumming test_selfhosting_new_empty_then_users: Test user adding with all group names. * tests/test_selfhosting_new_empty_then_users.cc: Use for loops to simplify the code and to make sure that we test adding of users with all the group types. This shows a problem: Privs::get_database_users() does not contain the expected user: group: somegroup with space characters1 user: someuser with space characters1for_somegroup with space characters1 2012-02-01 Murray Cumming test_selfhosting_new_empty_then_users: Improvements. * tests/test_selfhosting_new_empty_then_users.cc: Add tables that will be affected. Test strange characters in group and user names. 2012-02-01 Murray Cumming Add test_selfhosting_new_empty_then_users * glom/mode_design/users/dialog_groups_list.cc: on_button_group_new(): Move the group creation code to: * glom/libglom/db_utils.[h|cc]: * glom/libglom/privs.[h|cc]: set_table_privileges(): Return a bool to report failures. * Makefile_tests.am: * tests/test_selfhosting_new_empty_then_users.cc: Add this test to test simple creation of a group and a user. 2012-02-01 Murray Cumming Add test_selfhosting_new_from_example_operator. * glom/base_db.[h|cc]: Move add_user() to * glom/libglom/db_utils.[h|cc]: * glom/frame_glom.cc: * glom/mode_design/users/dialog_users_list.cc: Adapted. * glom/libglom/connectionpool.cc: invalidate_connection(): Also clear m_pFieldTypes to make sure that we refill it when making a new connection. * glom/libglom/data_structure/fieldtypes.[h|cc]: Add get_types_count(). * tests/test_selfhosting_utils.[h|cc]: Add test_selfhost() to start an already-existing .glom system. * Makefile_tests.am: * tests/test_selfhosting_new_from_example_operator.cc: Add this new test which attempts to re-open a .glom system as a non-developer user. This currently fails to get the list of tables from the database. I must investigate that. 2012-01-30 Murray Cumming Add test_selfhosting_new_empty_change_sysprefs. * Makefile_tests.am: * tests/test_selfhosting_new_empty_change_sysprefs.cc: Add this test to check that the writing and reading of System Preferences works. 2012-01-30 Murray Cumming test_selfhosting_new_empty: Move some code into test_selfhosting_utils * tests/test_selfhosting_utils.[h|cc]: Add functions for self-hosting of an empty new database, used by the existing code too. * Makefile_tests.am: * tests/test_selfhosting_new_empty.cc: Use test_selfhosting_utils to simplify this code, making it easier to create variations of this test. 2012-01-30 Murray Cumming test_selfhosting_new_empty: Simplify the cleanup code. * tests/test_selfhosting_new_empty.cc: Call cleanup if test() returns false, like we in the other tests, to avoid calling it in too many places. 2012-01-30 Murray Cumming Require the latest goocanvas because it has fixes that PrintLayout needs. * configure.ac: Require goocanvas 2.0.1. 2012-01-30 Murray Cumming Add translatable strings from OnlineGlom * glom/onlineglom_strings.cc: * Makefile.am: * po/POTFILES.in: Mention the new file. These strings are actually used here: http://gitorious.org/online-glom/gwt-glom/trees/master/src/main/resources/org/glom/web/client/ui and I must manually copy the translations across until I find a better way. 2012-01-30 Murray Cumming Translatable: Remove unimplemented get_title_or_name_original(). * glom/libglom/data_structure/translatable_item.h: This method is not used, of course. 2012-01-29 Murray Cumming TableInfo, Report, PrintLayout: Make member variables private. * glom/libglom/data_structure/print_layout.[h|cc]: * glom/libglom/data_structure/report.[h|cc]: * glom/libglom/data_structure/tableinfo.[h|cc]: Hide the member variables behind getters and setters. * glom/application.cc: * glom/base_db.cc: * glom/libglom/db_utils.cc: * glom/libglom/document/document.cc: * glom/libglom/report_builder.cc: * glom/mode_design/print_layouts/window_print_layout_edit.cc: * glom/mode_design/report_layout/dialog_layout_report.cc: * glom/navigation/box_tables.cc: * glom/print_layout/canvas_print_layout.[h|cc]: * glom/print_layout/print_layout_utils.cc: * tests/test_document_load.cc: Adapt. This avoids java-libglom generating getM_*() and setM_*() methods, as well as being generally correct. 2012-01-29 Murray Cumming Database Preferences: Really store the organization name in the database. * glom/libglom/db_utils.cc: set_database_preferences(): Also UPDATE the organization name. This fixes bug #668836 (alien) 2012-01-29 Murray Cumming Field Formatting: Related Choices: Default to showing the primary key. * glom/mode_design/layout/layout_item_dialogs/box_formatting.cc: on_combo_choices_relationship_changed(): By default, automatically choose the related table's primary key as the field to show in the choices. Other fields should then be shown (or looked up) based on the chosen ID. This avoids the confusion noticed here: https://bugzilla.gnome.org/show_bug.cgi?id=668759#c21 2012-01-29 Murray Cumming CellRendererDbList: Do not crash if one of the fields is hidden. * glom/mode_data/datawidget/cellrenderer_dblist.cc: repack_cells_related(): Do not crash if create_cell() returns 0, and add a comment explaining that that is OK. * glom/mode_data/datawidget/cellcreation.cc: Add explanatory comments. This fixes the second crash mentioned in #668759 (alien). 2012-01-29 Murray Cumming Choices: Allow the field to be be other than the primary key. * glom/mode_data/datawidget/treemodel_db.h: Make most methods and members private again, documentation what they *key methods and members really mean. * glom/mode_data/datawidget/treemodel_db_withextratext.[h|cc]: Add m_column_index_first and m_item_first members. Constructor: Set these by looking for the first LayoutItem_Field, because that is what we will want to show in the first cell of a combobox, which is where this model is used. Use these instead of the *key members, which were actually the primary key. We had previously assumed that the first field would always be the primary key, but we should not enforce that. This fixes crashing bug #668759 (alien). 2012-01-28 Murray Cumming ComboChoicesWithTreeModel: Make sure the model always has the primary key. * glom/libglom/data_structure/layout/layoutitem_field.h: predicate_LayoutItem_Field_IsSameField: Let this be used with containers of LayoutItems as well as just LayoutItem_Fields. * glom/libglom/utils.[h|cc]: Add get_layout_items_plus_primary_key(). * glom/mode_data/box_data_list.cc: create_layout(): Simplify code by using get_layout_items_plus_primary_key(). * glom/mode_data/datawidget/combochoiceswithtreemodel.cc: set_choices_related(): Use get_layout_items_plus_primary_key() so the model has the primary key, avoiding a warning and a later crash. 2012-01-27 Murray Cumming Test creation from examples in non-English locales. * Makefile_tests.am: * tests/test_selfhosting_new_from_example_in_locales.sh: Run the test_selfhosting_new_from_example example in various locales, to make sure that the libgda problem (see bug #668346), or something like it, does not come back. * tests/test_selfhosting_new_from_example.cc: Call setlocale(). 2012-01-25 Murray Cumming Document: Avoid accumulating old nodes in the XML. * glom/glom_document.dtd: : Port and server should be optional because the document can specify a SQLite file instead. * glom/libglom/document/document.cc: save_before(): Remove all children of the root node before recreating them, to avoid keeping old stuff. 2012-01-25 Murray Cumming Examples: Remove multiple trans_set nodes. * examples/example_film_manager.glom: * examples/example_lesson_planner.glom: * examples/example_music_collection.glom: * examples/example_project_manager.glom: * examples/example_smallbusiness.glom: