/** * called when switch the active mouse scrolling option * to set unset the scrolling * * \param toggle button * \param null * * \return FALSE * */ gboolean preferences_active_mouse_scrolling_left_pane ( GtkWidget *toggle_button, gpointer null ) { if ( conf.active_scrolling_left_pane ) g_signal_handlers_unblock_by_func ( gsb_gui_navigation_get_tree_view ( ), G_CALLBACK ( gsb_gui_navigation_check_scroll ), NULL ); else g_signal_handlers_block_by_func ( gsb_gui_navigation_get_tree_view ( ), G_CALLBACK ( gsb_gui_navigation_check_scroll ), NULL ); return FALSE; }
/** * make sensitive or unsensitive all that could change the account * while we are reconciling * * \param sensitive TRUE or FALSE * * \return * */ void gsb_reconcile_sensitive ( gboolean sensitive ) { GtkUIManager *ui_manager; ui_manager = gsb_menu_get_ui_manager ( ); gtk_widget_set_sensitive ( gsb_gui_navigation_get_tree_view ( ), sensitive ); gsb_gui_sensitive_headings (sensitive); /* add by pbiava 02/11/2009 */ gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( ui_manager, "/menubar/ViewMenu/ShowReconciled/" ), sensitive ); gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( ui_manager, "/menubar/ViewMenu/ShowArchived/" ), sensitive ); gtk_widget_set_sensitive ( gtk_ui_manager_get_widget (ui_manager, "/menubar/ViewMenu/ShowClosed/" ), sensitive ); gtk_widget_set_sensitive ( gtk_ui_manager_get_widget (ui_manager, "/menubar/EditMenu/ConvertToScheduled/" ), sensitive ); gtk_widget_set_sensitive ( gtk_ui_manager_get_widget (ui_manager, "/menubar/EditMenu/NewAccount/" ), sensitive ); gtk_widget_set_sensitive ( gtk_ui_manager_get_widget (ui_manager, "/menubar/EditMenu/RemoveAccount/" ), sensitive ); }
/** * open a new grisbi file, don't check anything about another opened file that must * have been done before * * \para filename the name of the file * * \return TRUE ok, FALSE problem * */ gboolean gsb_file_open_file ( gchar *filename ) { GSList *list_tmp; devel_debug (filename); if ( !filename || !strlen (filename)) return FALSE; gsb_status_wait ( TRUE ); gsb_status_message ( _("Loading accounts") ); /* try to load the file */ /* FIXME:BUG under Windows: for unknwon reason yet filename is cleared * when returning from gsb_file_load_open_file! * making application crashes! */ if ( gsb_file_load_open_file (filename)) { /* the file has been opened succesfully */ /* we make a backup if necessary */ if ( conf.sauvegarde_demarrage ) { gsb_file_save_backup (); gsb_file_set_modified ( FALSE ); } } else { /* Loading failed. */ gsb_status_message ( _("Failed to load accounts") ); if ( conf.sauvegarde_demarrage || conf.make_backup || conf.make_backup_every_minutes ) { gchar *tmpstr = g_strdup_printf ( _("Error loading file '%s'"), filename); gchar *tmpstr2 = g_strdup_printf ( _("Grisbi was unable to load file. You should find the last " "backups in '%s', they are saved with date and time into " "their name so you should find easily the last backup " "saved.\n" "Please contact the Grisbi's team on [email protected] " "to find what happened to you current file."), gsb_file_get_backup_path ()); dialogue_error_hint ( tmpstr2, tmpstr ); g_free ( tmpstr ); g_free ( tmpstr2 ); gsb_status_stop_wait ( TRUE ); return FALSE; } else { gchar *tmpstr = g_strdup_printf ( _("Error loading file '%s'"), filename); gchar *tmpstr2; if (gsb_file_get_backup_path ()) tmpstr2 = g_strdup_printf ( _("Grisbi was unable to load file and the backups seem not to " "be activated... This is a bad thing.\nYour backup path is '%s', " "try to find if earlier you had some backups in there ?\n" "Please contact the Grisbi's team on [email protected] " "to find what happened to you current file."), gsb_file_get_backup_path ()); else tmpstr2 = my_strdup ( _("Grisbi was unable to load file and the backups seem not " "to be activated... This is a bad thing.\n" "Please contact the Grisbi's team on " "[email protected] to find what happened to you " "current file.")); dialogue_error_hint ( tmpstr2, tmpstr ); g_free ( tmpstr ); g_free ( tmpstr2 ); gsb_status_stop_wait ( TRUE ); return FALSE; } } /* ok, here the file or backup is loaded */ gsb_status_message ( _("Checking schedulers")); /* the the name in the last opened files */ gsb_file_append_name_to_opened_list ( filename ); /* create the archives store data, ie the transaction wich will replace the archive in * the list of transactions */ gsb_data_archive_store_create_list (); /* create all the gui */ gsb_file_new_gui (); /* check the amounts of all the accounts */ gsb_status_message ( _("Checking amounts")); list_tmp = gsb_data_account_get_list_accounts (); while ( list_tmp ) { gint account_number; volatile gint value; account_number = gsb_data_account_get_no_account ( list_tmp -> data ); /* set the minimum balances to be shown or not */ value = gsb_real_cmp ( gsb_data_account_get_current_balance (account_number), gsb_data_account_get_mini_balance_authorized (account_number) ) == -1; gsb_data_account_set_mini_balance_authorized_message ( account_number, value); value = gsb_real_cmp ( gsb_data_account_get_current_balance (account_number), gsb_data_account_get_mini_balance_wanted (account_number) ) == -1; gsb_data_account_set_mini_balance_wanted_message ( account_number, value); list_tmp = list_tmp -> next; } /* set Grisbi title */ gsb_main_set_grisbi_title ( -1 ); /* update the main page */ mise_a_jour_accueil (TRUE); /* for now, the flag for modification of the file is ok, but the menu couldn't be set * as sensitive/unsensitive so do it now */ gsb_file_set_modified ( gsb_file_get_modified ( ) ); gsb_status_message ( _("Done") ); gsb_status_stop_wait ( TRUE ); /* go to the home page */ gsb_gui_navigation_set_selection ( GSB_HOME_PAGE, -1, NULL ); /* set the focus to the selection tree at left */ gtk_widget_grab_focus ( gsb_gui_navigation_get_tree_view ( ) ); return TRUE; }